Built with
Alectryon , running Coq+SerAPI v8.11.0+0.11.1. Bubbles (
) indicate interactive fragments: hover for details, tap to reveal contents. Use
Ctrl+↑ Ctrl+↓ to navigate,
Ctrl+🖱️ to focus. On Mac, use
⌘ instead of
Ctrl .
(* Distributed under the terms of the MIT license. *)
From MetaCoq.Template Require Import config utils Ast AstUtils Induction LiftSubst
UnivSubst Reduction WfInv Typing.
From Equations Require Import Equations.
Require Import ssreflect ssrbool.
Well-formedness of terms and types in typing derivations
The internal representation of terms is not canonical, so we show
that only well-formed terms and types can appear in typing derivations
and the global context.
Definition wf_decl d :=
match decl_body d with
| Some b => Ast.wf b
| None => True
end /\ Ast.wf (decl_type d).
Definition wf_decl_pred : context -> term -> option term -> Type :=
(fun _ t T => Ast.wf t /\ match T with
| Some T => Ast.wf T
| None => True
end ).
Lemma All_local_env_wf_decl :
forall (Γ : context ),
Forall wf_decl Γ -> All_local_env wf_decl_pred Γ.forall Γ : context ,
Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
Proof .forall Γ : context ,
Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
intros Γ X.Γ : context
X : Forall wf_decl Γ
All_local_env wf_decl_pred Γ
induction Γ in X |- *.All_local_env wf_decl_pred []
- All_local_env wf_decl_pred []
constructor ; eauto .
- a : context_decl
Γ : list context_decl
X : Forall wf_decl (a :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred (a :: Γ)
destruct a as [na [body|] ty].na : aname
body, ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
+ na : aname
body, ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
econstructor .na : aname
body, ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred Γ
* na : aname
body, ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred Γ
apply IHΓ.na : aname
body, ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
Forall wf_decl Γ
inv X; eauto .
* na : aname
body, ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
wf_decl_pred Γ ty None
red .na : aname
body, ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
Ast.wf ty /\ True
inv X. na : aname
body, ty : term
Γ : list context_decl
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H : wf_decl
{|
decl_name := na;
decl_body := Some body;
decl_type := ty |}
H0 : Forall wf_decl Γ
Ast.wf ty /\ True
split .na : aname
body, ty : term
Γ : list context_decl
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H : wf_decl
{|
decl_name := na;
decl_body := Some body;
decl_type := ty |}
H0 : Forall wf_decl Γ
Ast.wf ty
-- na : aname
body, ty : term
Γ : list context_decl
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H : wf_decl
{|
decl_name := na;
decl_body := Some body;
decl_type := ty |}
H0 : Forall wf_decl Γ
Ast.wf ty
apply H.
-- na : aname
body, ty : term
Γ : list context_decl
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H : wf_decl
{|
decl_name := na;
decl_body := Some body;
decl_type := ty |}
H0 : Forall wf_decl Γ
True
constructor .
* na : aname
body, ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
wf_decl_pred Γ body (Some ty)
red .na : aname
body, ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := Some body;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
Ast.wf body /\ Ast.wf ty
inv X. na : aname
body, ty : term
Γ : list context_decl
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H : wf_decl
{|
decl_name := na;
decl_body := Some body;
decl_type := ty |}
H0 : Forall wf_decl Γ
Ast.wf body /\ Ast.wf ty
eauto .
+ na : aname
ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: Γ)
econstructor .na : aname
ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred Γ
* na : aname
ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred Γ
apply IHΓ.na : aname
ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
Forall wf_decl Γ
inv X; eauto .
* na : aname
ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
wf_decl_pred Γ ty None
red .na : aname
ty : term
Γ : list context_decl
X : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: Γ)
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
Ast.wf ty /\ True
inv X. na : aname
ty : term
Γ : list context_decl
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H : wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
H0 : Forall wf_decl Γ
Ast.wf ty /\ True
split .na : aname
ty : term
Γ : list context_decl
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H : wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
H0 : Forall wf_decl Γ
Ast.wf ty
-- na : aname
ty : term
Γ : list context_decl
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H : wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
H0 : Forall wf_decl Γ
Ast.wf ty
apply H.
-- na : aname
ty : term
Γ : list context_decl
IHΓ : Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H : wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
H0 : Forall wf_decl Γ
True
constructor .
Qed .
Lemma on_global_env_impl `{checker_flags} Σ P Q :
(forall Σ Γ t T , on_global_env P Σ.1 -> P Σ Γ t T -> Q Σ Γ t T) ->
on_global_env P Σ -> on_global_env Q Σ.H : checker_flags
Σ : global_env
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
(forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term) (T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T) ->
on_global_env P Σ -> on_global_env Q Σ
Proof .H : checker_flags
Σ : global_env
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
(forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term) (T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T) ->
on_global_env P Σ -> on_global_env Q Σ
intros X X0.H : checker_flags
Σ : global_env
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term) (T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
X0 : on_global_env P Σ
on_global_env Q Σ
simpl in *.H : checker_flags
Σ : global_env
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term) (T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
X0 : on_global_env P Σ
on_global_env Q Σ
induction X0; constructor ; auto .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term) (T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
d : global_decl
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := TemplateLookup.universes_decl_of_decl d : universes_decl
o : on_udecl Σ udecl
o0 : on_global_decl P (Σ, udecl) kn d
IHX0 : on_global_env Q Σ
on_global_decl Q
(Σ, TemplateLookup.universes_decl_of_decl d) kn d
clear IHX0.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
d : global_decl
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := TemplateLookup.universes_decl_of_decl d : universes_decl
o : on_udecl Σ udecl
o0 : on_global_decl P (Σ, udecl) kn d
on_global_decl Q
(Σ, TemplateLookup.universes_decl_of_decl d) kn d
destruct d; simpl .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
c : constant_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := TemplateLookup.universes_decl_of_decl
(ConstantDecl c) : universes_decl
o : on_udecl Σ udecl
o0 : on_global_decl P (Σ, udecl) kn (ConstantDecl c)
on_constant_decl Q (Σ, cst_universes c) c
- H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
c : constant_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := TemplateLookup.universes_decl_of_decl
(ConstantDecl c) : universes_decl
o : on_udecl Σ udecl
o0 : on_global_decl P (Σ, udecl) kn (ConstantDecl c)
on_constant_decl Q (Σ, cst_universes c) c
destruct c; simpl .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
cst_type0 : term
cst_body0 : option term
cst_universes0 : universes_decl
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := TemplateLookup.universes_decl_of_decl
(ConstantDecl
{|
cst_type := cst_type0;
cst_body := cst_body0;
cst_universes := cst_universes0 |}) : universes_decl
o : on_udecl Σ udecl
o0 : on_global_decl P (Σ, udecl) kn
(ConstantDecl
{|
cst_type := cst_type0;
cst_body := cst_body0;
cst_universes := cst_universes0 |})
on_constant_decl Q (Σ, cst_universes0)
{|
cst_type := cst_type0;
cst_body := cst_body0;
cst_universes := cst_universes0 |}
destruct cst_body0; simpl in *.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t0 : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t0 T -> Q Σ0 Γ t0 T
Σ : global_env
kn : kername
cst_type0, t : term
cst_universes0 : universes_decl
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := cst_universes0 : universes_decl
o : on_udecl Σ udecl
o0 : on_constant_decl P (Σ, udecl)
{|
cst_type := cst_type0;
cst_body := Some t;
cst_universes := cst_universes0 |}
on_constant_decl Q (Σ, cst_universes0)
{|
cst_type := cst_type0;
cst_body := Some t;
cst_universes := cst_universes0 |}
red in o |- *.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t0 : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t0 T -> Q Σ0 Γ t0 T
Σ : global_env
kn : kername
cst_type0, t : term
cst_universes0 : universes_decl
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := cst_universes0 : universes_decl
o : LevelSet.For_all
(fun l : LevelSet.elt =>
~
LevelSet.In l (TemplateLookup.global_levels Σ))
(levels_of_udecl udecl) /\
ConstraintSet.For_all
(fun '(l1, _, l2) =>
LevelSet.In l1
(LevelSet.union (levels_of_udecl udecl)
(TemplateLookup.global_levels Σ)) /\
LevelSet.In l2
(LevelSet.union (levels_of_udecl udecl)
(TemplateLookup.global_levels Σ)))
(constraints_of_udecl udecl) /\
match udecl with
| Monomorphic_ctx ctx =>
LevelSet.for_all
(fun x : Level.t => ~~ Level.is_var x) ctx.1
| Polymorphic_ctx _ => True
end /\ satisfiable_udecl Σ udecl
o0 : on_constant_decl P (Σ, udecl)
{|
cst_type := cst_type0;
cst_body := Some t;
cst_universes := cst_universes0 |}
match
cst_body
{|
cst_type := cst_type0;
cst_body := Some t;
cst_universes := cst_universes0 |}
with
| Some trm =>
Q (Σ, cst_universes0) [] trm
(Some
(cst_type
{|
cst_type := cst_type0;
cst_body := Some t;
cst_universes := cst_universes0 |}))
| None =>
on_type Q (Σ, cst_universes0) []
(cst_type
{|
cst_type := cst_type0;
cst_body := Some t;
cst_universes := cst_universes0 |})
end
simpl in *.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t0 : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t0 T -> Q Σ0 Γ t0 T
Σ : global_env
kn : kername
cst_type0, t : term
cst_universes0 : universes_decl
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := cst_universes0 : universes_decl
o : LevelSet.For_all
(fun l : LevelSet.elt =>
~
LevelSet.In l (TemplateLookup.global_levels Σ))
(levels_of_udecl udecl) /\
ConstraintSet.For_all
(fun '(l1, _, l2) =>
LevelSet.In l1
(LevelSet.union (levels_of_udecl udecl)
(TemplateLookup.global_levels Σ)) /\
LevelSet.In l2
(LevelSet.union (levels_of_udecl udecl)
(TemplateLookup.global_levels Σ)))
(constraints_of_udecl udecl) /\
match udecl with
| Monomorphic_ctx ctx =>
LevelSet.for_all
(fun x : Level.t => ~~ Level.is_var x) ctx.1
| Polymorphic_ctx _ => True
end /\ satisfiable_udecl Σ udecl
o0 : on_constant_decl P (Σ, udecl)
{|
cst_type := cst_type0;
cst_body := Some t;
cst_universes := cst_universes0 |}
Q (Σ, cst_universes0) [] t (Some cst_type0)
now eapply X.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
cst_type0 : term
cst_universes0 : universes_decl
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := cst_universes0 : universes_decl
o : on_udecl Σ udecl
o0 : on_constant_decl P (Σ, udecl)
{|
cst_type := cst_type0;
cst_body := None;
cst_universes := cst_universes0 |}
on_constant_decl Q (Σ, cst_universes0)
{|
cst_type := cst_type0;
cst_body := None;
cst_universes := cst_universes0 |}
red in o |- *.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
cst_type0 : term
cst_universes0 : universes_decl
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := cst_universes0 : universes_decl
o : LevelSet.For_all
(fun l : LevelSet.elt =>
~
LevelSet.In l (TemplateLookup.global_levels Σ))
(levels_of_udecl udecl) /\
ConstraintSet.For_all
(fun '(l1, _, l2) =>
LevelSet.In l1
(LevelSet.union (levels_of_udecl udecl)
(TemplateLookup.global_levels Σ)) /\
LevelSet.In l2
(LevelSet.union (levels_of_udecl udecl)
(TemplateLookup.global_levels Σ)))
(constraints_of_udecl udecl) /\
match udecl with
| Monomorphic_ctx ctx =>
LevelSet.for_all
(fun x : Level.t => ~~ Level.is_var x) ctx.1
| Polymorphic_ctx _ => True
end /\ satisfiable_udecl Σ udecl
o0 : on_constant_decl P (Σ, udecl)
{|
cst_type := cst_type0;
cst_body := None;
cst_universes := cst_universes0 |}
match
cst_body
{|
cst_type := cst_type0;
cst_body := None;
cst_universes := cst_universes0 |}
with
| Some trm =>
Q (Σ, cst_universes0) [] trm
(Some
(cst_type
{|
cst_type := cst_type0;
cst_body := None;
cst_universes := cst_universes0 |}))
| None =>
on_type Q (Σ, cst_universes0) []
(cst_type
{|
cst_type := cst_type0;
cst_body := None;
cst_universes := cst_universes0 |})
end
simpl in *.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
cst_type0 : term
cst_universes0 : universes_decl
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := cst_universes0 : universes_decl
o : LevelSet.For_all
(fun l : LevelSet.elt =>
~
LevelSet.In l (TemplateLookup.global_levels Σ))
(levels_of_udecl udecl) /\
ConstraintSet.For_all
(fun '(l1, _, l2) =>
LevelSet.In l1
(LevelSet.union (levels_of_udecl udecl)
(TemplateLookup.global_levels Σ)) /\
LevelSet.In l2
(LevelSet.union (levels_of_udecl udecl)
(TemplateLookup.global_levels Σ)))
(constraints_of_udecl udecl) /\
match udecl with
| Monomorphic_ctx ctx =>
LevelSet.for_all
(fun x : Level.t => ~~ Level.is_var x) ctx.1
| Polymorphic_ctx _ => True
end /\ satisfiable_udecl Σ udecl
o0 : on_constant_decl P (Σ, udecl)
{|
cst_type := cst_type0;
cst_body := None;
cst_universes := cst_universes0 |}
on_type Q (Σ, cst_universes0) [] cst_type0
now eapply X.
- H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := TemplateLookup.universes_decl_of_decl
(InductiveDecl m) : universes_decl
o : on_udecl Σ udecl
o0 : on_global_decl P (Σ, udecl) kn (InductiveDecl m)
on_inductive Q (Σ, ind_universes m) kn m
simpl in *.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
o0 : on_inductive P (Σ, udecl) kn m
on_inductive Q (Σ, ind_universes m) kn m
destruct o0 as [onI onP onNP].H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
on_inductive Q (Σ, ind_universes m) kn m
constructor ; auto .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
Alli (on_ind_body Q (Σ, ind_universes m) kn m) 0
(ind_bodies m)
-- H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
Alli (on_ind_body Q (Σ, ind_universes m) kn m) 0
(ind_bodies m)
eapply Alli_impl.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
Alli ?P 0 (ind_bodies m)
exact onI.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
forall (n : nat) (x : one_inductive_body),
on_ind_body P (Σ, udecl) kn m n x ->
on_ind_body Q (Σ, ind_universes m) kn m n x
eauto .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
forall (n : nat) (x : one_inductive_body),
on_ind_body P (Σ, udecl) kn m n x ->
on_ind_body Q (Σ, ind_universes m) kn m n x
intros .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
on_ind_body Q (Σ, ind_universes m) kn m n x
refine {| ind_arity_eq := X1.(ind_arity_eq);
ind_cunivs := X1.(ind_cunivs) |}.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
on_type Q (Σ, ind_universes m) [] (ind_type x)
--- H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
on_type Q (Σ, ind_universes m) [] (ind_type x)
apply onArity in X1.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_type P (Σ, udecl) [] (ind_type x)
on_type Q (Σ, ind_universes m) [] (ind_type x)
unfold on_type in *; simpl in *.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : P (Σ, udecl) [] (ind_type x) None
Q (Σ, ind_universes m) [] (ind_type x) None
now eapply X.
--- H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
on_constructors Q (Σ, ind_universes m) m n x
(ind_indices x) (ind_ctors x)
(ind_cunivs X1)
pose proof X1.(onConstructors) as X11.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
X11 : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
(ind_cunivs X1)
on_constructors Q (Σ, ind_universes m) m n x
(ind_indices x) (ind_ctors x)
(ind_cunivs X1)
red in X11.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
X11 : All2
(on_constructor P (Σ, udecl) m n x
(ind_indices x)) (ind_ctors x)
(ind_cunivs X1)
on_constructors Q (Σ, ind_universes m) m n x
(ind_indices x) (ind_ctors x)
(ind_cunivs X1)
eapply All2_impl; eauto .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
X11 : All2
(on_constructor P (Σ, udecl) m n x
(ind_indices x)) (ind_ctors x)
(ind_cunivs X1)
forall (x0 : constructor_body) (y : list Universe.t),
on_constructor P (Σ, udecl) m n x (ind_indices x) x0 y ->
on_constructor Q (Σ, ind_universes m) m n x
(ind_indices x) x0 y
simpl .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
X11 : All2
(on_constructor P (Σ, udecl) m n x
(ind_indices x)) (ind_ctors x)
(ind_cunivs X1)
forall (x0 : constructor_body) (y : list Universe.t),
on_constructor P (Σ, udecl) m n x (ind_indices x) x0 y ->
on_constructor Q (Σ, ind_universes m) m n x
(ind_indices x) x0 y
intros .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
X11 : All2
(on_constructor P (Σ, udecl) m n x
(ind_indices x)) (ind_ctors x)
(ind_cunivs X1)
x0 : constructor_body
y : list Universe .t
X2 : on_constructor P (Σ, udecl) m n x
(ind_indices x) x0 y
on_constructor Q (Σ, ind_universes m) m n x
(ind_indices x) x0 y
destruct X2 as [? ? ? ?]; unshelve econstructor ; eauto .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
X11 : All2
(on_constructor P (Σ, udecl) m n x
(ind_indices x)) (ind_ctors x)
(ind_cunivs X1)
x0 : constructor_body
y : list Universe .t
cstr_args_length : context_assumptions (cstr_args x0) =
cstr_arity x0
cstr_eq : cstr_type x0 =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (cstr_args x0)
(cstr_concl m n x x0))
on_ctype : on_type P (Σ, udecl)
(arities_context (ind_bodies m))
(cstr_type x0)
on_cargs : sorts_local_ctx P (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m) (cstr_args x0) y
on_cindices : TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
P Σ0 Γ t (Some T)) (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m,,, cstr_args x0)
(cstr_indices x0)
(List.rev
(lift_context #|cstr_args x0| 0
(ind_indices x)))
on_ctype_positive : positive_cstr m n []
(cstr_type x0)
on_ctype_variance : forall v : list Variance.t,
ind_variance m = Some v ->
cstr_respects_variance (Σ, udecl)
m v x0
on_type Q (Σ, ind_universes m)
(arities_context (ind_bodies m))
(cstr_type x0)
* H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
X11 : All2
(on_constructor P (Σ, udecl) m n x
(ind_indices x)) (ind_ctors x)
(ind_cunivs X1)
x0 : constructor_body
y : list Universe .t
cstr_args_length : context_assumptions (cstr_args x0) =
cstr_arity x0
cstr_eq : cstr_type x0 =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (cstr_args x0)
(cstr_concl m n x x0))
on_ctype : on_type P (Σ, udecl)
(arities_context (ind_bodies m))
(cstr_type x0)
on_cargs : sorts_local_ctx P (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m) (cstr_args x0) y
on_cindices : TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
P Σ0 Γ t (Some T)) (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m,,, cstr_args x0)
(cstr_indices x0)
(List.rev
(lift_context #|cstr_args x0| 0
(ind_indices x)))
on_ctype_positive : positive_cstr m n []
(cstr_type x0)
on_ctype_variance : forall v : list Variance.t,
ind_variance m = Some v ->
cstr_respects_variance (Σ, udecl)
m v x0
on_type Q (Σ, ind_universes m)
(arities_context (ind_bodies m))
(cstr_type x0)
apply X; eauto .
* H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
X11 : All2
(on_constructor P (Σ, udecl) m n x
(ind_indices x)) (ind_ctors x)
(ind_cunivs X1)
x0 : constructor_body
y : list Universe .t
cstr_args_length : context_assumptions (cstr_args x0) =
cstr_arity x0
cstr_eq : cstr_type x0 =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (cstr_args x0)
(cstr_concl m n x x0))
on_ctype : on_type P (Σ, udecl)
(arities_context (ind_bodies m))
(cstr_type x0)
on_cargs : sorts_local_ctx P (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m) (cstr_args x0) y
on_cindices : TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
P Σ0 Γ t (Some T)) (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m,,, cstr_args x0)
(cstr_indices x0)
(List.rev
(lift_context #|cstr_args x0| 0
(ind_indices x)))
on_ctype_positive : positive_cstr m n []
(cstr_type x0)
on_ctype_variance : forall v : list Variance.t,
ind_variance m = Some v ->
cstr_respects_variance (Σ, udecl)
m v x0
sorts_local_ctx Q (Σ, ind_universes m)
(arities_context (ind_bodies m),,, ind_params m)
(cstr_args x0) y
clear -X0 X on_cargs.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
m : mutual_inductive_body
X0 : on_global_env P Σ
udecl := ind_universes m : universes_decl
x0 : constructor_body
y : list Universe .t
on_cargs : sorts_local_ctx P (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m) (cstr_args x0) y
sorts_local_ctx Q (Σ, ind_universes m)
(arities_context (ind_bodies m),,, ind_params m)
(cstr_args x0) y
revert on_cargs.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
m : mutual_inductive_body
X0 : on_global_env P Σ
udecl := ind_universes m : universes_decl
x0 : constructor_body
y : list Universe .t
sorts_local_ctx P (Σ, udecl)
(arities_context (ind_bodies m),,, ind_params m)
(cstr_args x0) y ->
sorts_local_ctx Q (Σ, ind_universes m)
(arities_context (ind_bodies m),,, ind_params m)
(cstr_args x0) y
generalize (cstr_args x0), y.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
m : mutual_inductive_body
X0 : on_global_env P Σ
udecl := ind_universes m : universes_decl
x0 : constructor_body
y : list Universe .t
forall (c : context ) (y0 : list Universe.t),
sorts_local_ctx P (Σ, udecl)
(arities_context (ind_bodies m),,, ind_params m) c
y0 ->
sorts_local_ctx Q (Σ, ind_universes m)
(arities_context (ind_bodies m),,, ind_params m) c
y0
induction c; destruct y0; simpl ; auto ;
destruct a as [na [b|] ty]; simpl in *; auto ;
split ; intuition eauto .
* H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
X11 : All2
(on_constructor P (Σ, udecl) m n x
(ind_indices x)) (ind_ctors x)
(ind_cunivs X1)
x0 : constructor_body
y : list Universe .t
cstr_args_length : context_assumptions (cstr_args x0) =
cstr_arity x0
cstr_eq : cstr_type x0 =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (cstr_args x0)
(cstr_concl m n x x0))
on_ctype : on_type P (Σ, udecl)
(arities_context (ind_bodies m))
(cstr_type x0)
on_cargs : sorts_local_ctx P (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m) (cstr_args x0) y
on_cindices : TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
P Σ0 Γ t (Some T)) (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m,,, cstr_args x0)
(cstr_indices x0)
(List.rev
(lift_context #|cstr_args x0| 0
(ind_indices x)))
on_ctype_positive : positive_cstr m n []
(cstr_type x0)
on_ctype_variance : forall v : list Variance.t,
ind_variance m = Some v ->
cstr_respects_variance (Σ, udecl)
m v x0
TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
Q Σ0 Γ t (Some T)) (Σ, ind_universes m)
(arities_context (ind_bodies m),,, ind_params m,,,
cstr_args x0) (cstr_indices x0)
(List.rev
(lift_context #|cstr_args x0| 0 (ind_indices x)))
clear -X0 X on_cindices.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
m : mutual_inductive_body
X0 : on_global_env P Σ
udecl := ind_universes m : universes_decl
x : one_inductive_body
x0 : constructor_body
on_cindices : TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
P Σ0 Γ t (Some T)) (Σ, udecl)
(arities_context (ind_bodies m),,,
ind_params m,,, cstr_args x0)
(cstr_indices x0)
(List.rev
(lift_context #|cstr_args x0| 0
(ind_indices x)))
TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
Q Σ0 Γ t (Some T)) (Σ, ind_universes m)
(arities_context (ind_bodies m),,, ind_params m,,,
cstr_args x0) (cstr_indices x0)
(List.rev
(lift_context #|cstr_args x0| 0 (ind_indices x)))
revert on_cindices.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
m : mutual_inductive_body
X0 : on_global_env P Σ
udecl := ind_universes m : universes_decl
x : one_inductive_body
x0 : constructor_body
TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
P Σ0 Γ t (Some T)) (Σ, udecl)
(arities_context (ind_bodies m),,, ind_params m,,,
cstr_args x0) (cstr_indices x0)
(List.rev
(lift_context #|cstr_args x0| 0 (ind_indices x))) ->
TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
Q Σ0 Γ t (Some T)) (Σ, ind_universes m)
(arities_context (ind_bodies m),,, ind_params m,,,
cstr_args x0) (cstr_indices x0)
(List.rev
(lift_context #|cstr_args x0| 0 (ind_indices x)))
generalize (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x))).H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
m : mutual_inductive_body
X0 : on_global_env P Σ
udecl := ind_universes m : universes_decl
x : one_inductive_body
x0 : constructor_body
forall l : list context_decl,
TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
P Σ0 Γ t (Some T)) (Σ, udecl)
(arities_context (ind_bodies m),,, ind_params m,,,
cstr_args x0) (cstr_indices x0) l ->
TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
Q Σ0 Γ t (Some T)) (Σ, ind_universes m)
(arities_context (ind_bodies m),,, ind_params m,,,
cstr_args x0) (cstr_indices x0) l
generalize (cstr_indices x0).H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
m : mutual_inductive_body
X0 : on_global_env P Σ
udecl := ind_universes m : universes_decl
x : one_inductive_body
x0 : constructor_body
forall (l : list term) (l0 : list context_decl),
TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
P Σ0 Γ t (Some T)) (Σ, udecl)
(arities_context (ind_bodies m),,, ind_params m,,,
cstr_args x0) l l0 ->
TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
Q Σ0 Γ t (Some T)) (Σ, ind_universes m)
(arities_context (ind_bodies m),,, ind_params m,,,
cstr_args x0) l l0
induction 1 ; simpl ; constructor ; auto .
--- H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] => on_projections m kn n x (ind_indices x) o0
| o0 :: _ :: _ => False
end
simpl ; intros .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
H0 : ind_projs x <> []
match ind_ctors x with
| [] => False
| [o0] => on_projections m kn n x (ind_indices x) o0
| o0 :: _ :: _ => False
end
apply (onProjections X1 H0).
--- H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
check_ind_sorts Q (Σ, ind_universes m)
(ind_params m) (ind_kelim x)
(ind_indices x) (ind_cunivs X1)
(ind_sort x)
destruct X1.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : check_ind_sorts P (Σ, udecl)
(ind_params m) (ind_kelim x)
(ind_indices x) ind_cunivs
(ind_sort x)
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
check_ind_sorts Q (Σ, ind_universes m)
(ind_params m) (ind_kelim x)
(ind_indices x)
(Typing.ind_cunivs
{|
ind_arity_eq := ind_arity_eq;
onArity := onArity;
ind_cunivs := ind_cunivs;
onConstructors := onConstructors;
onProjections := onProjections;
ind_sorts := ind_sorts;
onIndices := onIndices |})
(ind_sort x)
simpl .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : check_ind_sorts P (Σ, udecl)
(ind_params m) (ind_kelim x)
(ind_indices x) ind_cunivs
(ind_sort x)
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
check_ind_sorts Q (Σ, ind_universes m)
(ind_params m) (ind_kelim x)
(ind_indices x) ind_cunivs
(ind_sort x)
unfold check_ind_sorts in *.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : if Universe .is_prop (ind_sort x)
then
is_true
(allowed_eliminations_subset
(ind_kelim x)
(elim_sort_prop_ind ind_cunivs))
else
if Universe .is_sprop (ind_sort x)
then
is_true
(allowed_eliminations_subset
(ind_kelim x)
(elim_sort_sprop_ind ind_cunivs))
else
check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, udecl)) ind_cunivs
(ind_sort x) *
(if indices_matter
then
type_local_ctx P (Σ, udecl)
(ind_params m) (ind_indices x)
(ind_sort x)
else True )
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
if Universe .is_prop (ind_sort x)
then
is_true
(allowed_eliminations_subset
(ind_kelim x) (elim_sort_prop_ind ind_cunivs))
else
if Universe .is_sprop (ind_sort x)
then
is_true
(allowed_eliminations_subset
(ind_kelim x) (elim_sort_sprop_ind ind_cunivs))
else
check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, ind_universes m)) ind_cunivs
(ind_sort x) *
(if indices_matter
then
type_local_ctx Q (Σ, ind_universes m)
(ind_params m) (ind_indices x)
(ind_sort x)
else True )
destruct Universe .is_prop; auto .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : if Universe .is_sprop (ind_sort x)
then
is_true
(allowed_eliminations_subset
(ind_kelim x)
(elim_sort_sprop_ind ind_cunivs))
else
check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, udecl)) ind_cunivs
(ind_sort x) *
(if indices_matter
then
type_local_ctx P (Σ, udecl)
(ind_params m) (ind_indices x)
(ind_sort x)
else True )
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
if Universe .is_sprop (ind_sort x)
then
is_true
(allowed_eliminations_subset
(ind_kelim x) (elim_sort_sprop_ind ind_cunivs))
else
check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, ind_universes m)) ind_cunivs
(ind_sort x) *
(if indices_matter
then
type_local_ctx Q (Σ, ind_universes m)
(ind_params m) (ind_indices x)
(ind_sort x)
else True )
destruct Universe .is_sprop; auto .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, udecl)) ind_cunivs
(ind_sort x) *
(if indices_matter
then
type_local_ctx P (Σ, udecl)
(ind_params m) (ind_indices x)
(ind_sort x)
else True )
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, ind_universes m)) ind_cunivs
(ind_sort x) *
(if indices_matter
then
type_local_ctx Q (Σ, ind_universes m)
(ind_params m) (ind_indices x)
(ind_sort x)
else True )
split .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, udecl)) ind_cunivs
(ind_sort x) *
(if indices_matter
then
type_local_ctx P (Σ, udecl)
(ind_params m) (ind_indices x)
(ind_sort x)
else True )
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, ind_universes m)) ind_cunivs
(ind_sort x)
apply ind_sorts.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, udecl)) ind_cunivs
(ind_sort x) *
(if indices_matter
then
type_local_ctx P (Σ, udecl)
(ind_params m) (ind_indices x)
(ind_sort x)
else True )
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
if indices_matter
then
type_local_ctx Q (Σ, ind_universes m)
(ind_params m) (ind_indices x)
(ind_sort x)
else True
destruct indices_matter; auto .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, udecl)) ind_cunivs
(ind_sort x) *
type_local_ctx P (Σ, udecl)
(ind_params m) (ind_indices x)
(ind_sort x)
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
type_local_ctx Q (Σ, ind_universes m)
(ind_params m) (ind_indices x)
(ind_sort x)
eapply type_local_ctx_impl.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, udecl)) ind_cunivs
(ind_sort x) *
type_local_ctx P (Σ, udecl)
(ind_params m) (ind_indices x)
(ind_sort x)
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
type_local_ctx ?P (Σ, ind_universes m)
(ind_params m) (ind_indices x)
(ind_sort x)
eapply ind_sorts.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
ind_arity_eq : ind_type x =
it_mkProd_or_LetIn (ind_params m)
(it_mkProd_or_LetIn (ind_indices x)
(tSort (ind_sort x)))
onArity : on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs : list constructor_univs
onConstructors : on_constructors P (Σ, udecl) m n x
(ind_indices x) (ind_ctors x)
ind_cunivs
onProjections : ind_projs x <> [] ->
match ind_ctors x with
| [] => False
| [o0] =>
on_projections m kn n x
(ind_indices x) o0
| o0 :: _ :: _ => False
end
ind_sorts : check_constructors_smaller
(TemplateLookup.global_ext_constraints
(Σ, udecl)) ind_cunivs
(ind_sort x) *
type_local_ctx P (Σ, udecl)
(ind_params m) (ind_indices x)
(ind_sort x)
onIndices : forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, udecl) m v
(ind_indices x)
forall (Γ : context ) (t : term) (T : option term),
P (Σ, ind_universes m) Γ t T ->
Q (Σ, ind_universes m) Γ t T
auto .
--- H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
n : nat
x : one_inductive_body
X1 : on_ind_body P (Σ, udecl) kn m n x
forall v : list Variance.t,
ind_variance m = Some v ->
ind_respects_variance (Σ, ind_universes m) m v
(ind_indices x)
apply (onIndices X1).
-- H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : on_context P (Σ, udecl) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
on_context Q (Σ, ind_universes m) (ind_params m)
red in onP.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : TemplateEnvTyping.All_local_env
(P (Σ, udecl)) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
on_context Q (Σ, ind_universes m) (ind_params m)
red .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : TemplateEnvTyping.All_local_env
(P (Σ, udecl)) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
TemplateEnvTyping.All_local_env
(Q (Σ, ind_universes m))
(ind_params m)
eapply All_local_env_impl.H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : TemplateEnvTyping.All_local_env
(P (Σ, udecl)) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
TemplateEnvTyping.All_local_env ?P (ind_params m)
eauto .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ : context ) (t : term)
(T : option term),
on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : TemplateEnvTyping.All_local_env
(P (Σ, udecl)) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
forall (Γ : context ) (t : term) (T : option term),
P (Σ, udecl) Γ t T -> Q (Σ, ind_universes m) Γ t T
intros .H : checker_flags
P : global_env_ext ->
context -> term -> option term -> Type
Q : global_env × universes_decl ->
context -> term -> option term -> Type
X : forall (Σ0 : global_env × universes_decl)
(Γ0 : context ) (t0 : term)
(T0 : option term),
on_global_env P Σ0.1 ->
P Σ0 Γ0 t0 T0 -> Q Σ0 Γ0 t0 T0
Σ : global_env
kn : kername
m : mutual_inductive_body
X0 : on_global_env P Σ
f : fresh_global kn Σ
udecl := ind_universes m : universes_decl
o : on_udecl Σ udecl
onI : Alli (on_ind_body P (Σ, udecl) kn m) 0
(ind_bodies m)
onP : TemplateEnvTyping.All_local_env
(P (Σ, udecl)) (ind_params m)
onNP : context_assumptions (ind_params m) =
ind_npars m
onVariance : on_variance (ind_universes m)
(ind_variance m)
Γ : context
t : term
T : option term
X1 : P (Σ, udecl) Γ t T
Q (Σ, ind_universes m) Γ t T
now apply X.
Qed .
Lemma All_local_env_wf_decl_inv :
forall (a : context_decl) (Γ : list context_decl)
(X : All_local_env wf_decl_pred (a :: Γ)),
on_local_decl wf_decl_pred Γ a * All_local_env wf_decl_pred Γ.forall (a : context_decl) (Γ : list context_decl),
All_local_env wf_decl_pred (a :: Γ) ->
on_local_decl wf_decl_pred Γ a
× All_local_env wf_decl_pred Γ
Proof .forall (a : context_decl) (Γ : list context_decl),
All_local_env wf_decl_pred (a :: Γ) ->
on_local_decl wf_decl_pred Γ a
× All_local_env wf_decl_pred Γ
intros a Γ X.a : context_decl
Γ : list context_decl
X : All_local_env wf_decl_pred (a :: Γ)
on_local_decl wf_decl_pred Γ a *
All_local_env wf_decl_pred Γ
inv X; intuition ; red ; simpl ; eauto .
Qed .
Lemma wf_strip_outer_cast t : Ast.wf t -> Ast.wf (strip_outer_cast t).Ast.wf t -> Ast.wf (strip_outer_cast t)
Proof .Ast.wf t -> Ast.wf (strip_outer_cast t)
induction t; auto .t1 : term
kind : cast_kind
t2 : term
IHt1 : Ast.wf t1 -> Ast.wf (strip_outer_cast t1)
IHt2 : Ast.wf t2 -> Ast.wf (strip_outer_cast t2)
Ast.wf (tCast t1 kind t2) ->
Ast.wf (strip_outer_cast (tCast t1 kind t2))
simpl .t1 : term
kind : cast_kind
t2 : term
IHt1 : Ast.wf t1 -> Ast.wf (strip_outer_cast t1)
IHt2 : Ast.wf t2 -> Ast.wf (strip_outer_cast t2)
Ast.wf (tCast t1 kind t2) ->
Ast.wf (strip_outer_cast t1)
intros H; now inv H.
Qed .
Lemma wf_mkApps_napp t u : ~~ isApp t -> Ast.wf (mkApps t u) -> Ast.wf t /\ List.Forall Ast.wf u.~~ isApp t ->
Ast.wf (mkApps t u) -> Ast.wf t /\ Forall Ast.wf u
Proof .~~ isApp t ->
Ast.wf (mkApps t u) -> Ast.wf t /\ Forall Ast.wf u
induction u in t |- *; simpl .~~ isApp t -> Ast.wf t -> Ast.wf t /\ Forall Ast.wf []
- ~~ isApp t -> Ast.wf t -> Ast.wf t /\ Forall Ast.wf []
intuition .
- t, a : term
u : list term
IHu : forall t0 : term,
~~ isApp t0 -> Ast.wf (mkApps t0 u) -> Ast.wf t0 /\ Forall Ast.wf u
~~ isApp t ->
Ast.wf
match t with
| tApp f args => tApp f (args ++ a :: u)
| _ => tApp t (a :: u)
end -> Ast.wf t /\ Forall Ast.wf (a :: u)
intros Happ H; destruct t; try solve [inv H; intuition auto ].t : term
args : list term
a : term
u : list term
IHu : forall t0 : term,
~~ isApp t0 ->
Ast.wf (mkApps t0 u) ->
Ast.wf t0 /\ Forall Ast.wf u
Happ : is_true (~~ isApp (tApp t args))
H : Ast.wf (tApp t (args ++ a :: u))
Ast.wf (tApp t args) /\ Forall Ast.wf (a :: u)
specialize (IHu (tApp t (u ++ [a]))).t : term
args : list term
a : term
u : list term
IHu : ~~ isApp (tApp t (u ++ [a])) ->
Ast.wf (mkApps (tApp t (u ++ [a])) u) ->
Ast.wf (tApp t (u ++ [a])) /\ Forall Ast.wf u
Happ : is_true (~~ isApp (tApp t args))
H : Ast.wf (tApp t (args ++ a :: u))
Ast.wf (tApp t args) /\ Forall Ast.wf (a :: u)
forward IHu. t : term
args : list term
a : term
u : list term
IHu : ~~ isApp (tApp t (u ++ [a])) ->
Ast.wf (mkApps (tApp t (u ++ [a])) u) ->
Ast.wf (tApp t (u ++ [a])) /\ Forall Ast.wf u
Happ : is_true (~~ isApp (tApp t args))
H : Ast.wf (tApp t (args ++ a :: u))
is_true (~~ isApp (tApp t (u ++ [a])))
induction u; trivial .t : term
args : list term
a : term
u : list term
IHu : Ast.wf (mkApps (tApp t (u ++ [a])) u) ->
Ast.wf (tApp t (u ++ [a])) /\ Forall Ast.wf u
Happ : is_true (~~ isApp (tApp t args))
H : Ast.wf (tApp t (args ++ a :: u))
Ast.wf (tApp t args) /\ Forall Ast.wf (a :: u)
discriminate .
Qed .
Hint Resolve wf_mkApps_napp : wf .
Lemma wf_mkApps_inv t u : Ast.wf (mkApps t u) -> List.Forall Ast.wf u.Ast.wf (mkApps t u) -> Forall Ast.wf u
Proof .Ast.wf (mkApps t u) -> Forall Ast.wf u
induction u in t |- *; simpl .Ast.wf t -> Forall Ast.wf []
- Ast.wf t -> Forall Ast.wf []
intuition .
- t, a : term
u : list term
IHu : forall t0 : term, Ast.wf (mkApps t0 u) -> Forall Ast.wf u
Ast.wf
match t with
| tApp f args => tApp f (args ++ a :: u)
| _ => tApp t (a :: u)
end -> Forall Ast.wf (a :: u)
intros H; destruct t; try solve [inv H; intuition auto ].t : term
args : list term
a : term
u : list term
IHu : forall t0 : term,
Ast.wf (mkApps t0 u) -> Forall Ast.wf u
H : Ast.wf (tApp t (args ++ a :: u))
Forall Ast.wf (a :: u)
specialize (IHu (tApp t (args ++ [a]))).t : term
args : list term
a : term
u : list term
IHu : Ast.wf (mkApps (tApp t (args ++ [a])) u) ->
Forall Ast.wf u
H : Ast.wf (tApp t (args ++ a :: u))
Forall Ast.wf (a :: u)
forward IHu. t : term
args : list term
a : term
u : list term
IHu : Ast.wf (mkApps (tApp t (args ++ [a])) u) ->
Forall Ast.wf u
H : Ast.wf (tApp t (args ++ a :: u))
Ast.wf (mkApps (tApp t (args ++ [a])) u)
induction u; trivial .t : term
args : list term
a, a0 : term
u : list term
IHu : Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u)) ->
Forall Ast.wf (a0 :: u)
H : Ast.wf (tApp t (args ++ a :: a0 :: u))
IHu0 : (Ast.wf (mkApps (tApp t (args ++ [a])) u) ->
Forall Ast.wf u) ->
Ast.wf (tApp t (args ++ a :: u)) ->
Ast.wf (mkApps (tApp t (args ++ [a])) u)
Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u))
simpl .t : term
args : list term
a, a0 : term
u : list term
IHu : Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u)) ->
Forall Ast.wf (a0 :: u)
H : Ast.wf (tApp t (args ++ a :: a0 :: u))
IHu0 : (Ast.wf (mkApps (tApp t (args ++ [a])) u) ->
Forall Ast.wf u) ->
Ast.wf (tApp t (args ++ a :: u)) ->
Ast.wf (mkApps (tApp t (args ++ [a])) u)
Ast.wf (tApp t ((args ++ [a]) ++ a0 :: u))
rewrite <- app_assoc.t : term
args : list term
a, a0 : term
u : list term
IHu : Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u)) ->
Forall Ast.wf (a0 :: u)
H : Ast.wf (tApp t (args ++ a :: a0 :: u))
IHu0 : (Ast.wf (mkApps (tApp t (args ++ [a])) u) ->
Forall Ast.wf u) ->
Ast.wf (tApp t (args ++ a :: u)) ->
Ast.wf (mkApps (tApp t (args ++ [a])) u)
Ast.wf (tApp t (args ++ [a] ++ a0 :: u))
simpl .t : term
args : list term
a, a0 : term
u : list term
IHu : Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u)) ->
Forall Ast.wf (a0 :: u)
H : Ast.wf (tApp t (args ++ a :: a0 :: u))
IHu0 : (Ast.wf (mkApps (tApp t (args ++ [a])) u) ->
Forall Ast.wf u) ->
Ast.wf (tApp t (args ++ a :: u)) ->
Ast.wf (mkApps (tApp t (args ++ [a])) u)
Ast.wf (tApp t (args ++ a :: a0 :: u))
apply H.t : term
args : list term
a : term
u : list term
IHu : Forall Ast.wf u
H : Ast.wf (tApp t (args ++ a :: u))
Forall Ast.wf (a :: u)
intuition .t : term
args : list term
a : term
u : list term
IHu : Forall Ast.wf u
H : Ast.wf (tApp t (args ++ a :: u))
Forall Ast.wf (a :: u)
inv H. t : term
args : list term
a : term
u : list term
IHu : Forall Ast.wf u
H0 : isApp t = false
H1 : args ++ a :: u <> []
H2 : Ast.wf t
H3 : Forall Ast.wf (args ++ a :: u)
Forall Ast.wf (a :: u)
apply Forall_app in H3.t : term
args : list term
a : term
u : list term
IHu : Forall Ast.wf u
H0 : isApp t = false
H1 : args ++ a :: u <> []
H2 : Ast.wf t
H3 : Forall Ast.wf args /\ Forall Ast.wf (a :: u)
Forall Ast.wf (a :: u)
intuition .
Qed .
Hint Resolve wf_mkApps_inv : wf .
Hint Constructors Ast.wf : wf .
Lemma isLambda_isApp t : isLambda t = true -> ~~ isApp t.isLambda t = true -> ~~ isApp t
Proof .isLambda t = true -> ~~ isApp t
destruct t; simpl ; congruence . Qed .
Lemma unfold_fix_wf :
forall (mfix : mfixpoint term) (idx : nat) (narg : nat) (fn : term),
unfold_fix mfix idx = Some (narg, fn) ->
Ast.wf (tFix mfix idx) ->
Ast.wf fn.forall (mfix : mfixpoint term) (idx narg : nat)
(fn : term),
unfold_fix mfix idx = Some (narg, fn) ->
Ast.wf (tFix mfix idx) -> Ast.wf fn
Proof .forall (mfix : mfixpoint term) (idx narg : nat)
(fn : term),
unfold_fix mfix idx = Some (narg, fn) ->
Ast.wf (tFix mfix idx) -> Ast.wf fn
intros mfix idx narg fn Hf Hwf.mfix : mfixpoint term
idx, narg : nat
fn : term
Hf : unfold_fix mfix idx = Some (narg, fn)
Hwf : Ast.wf (tFix mfix idx)
Ast.wf fn
unfold unfold_fix in Hf.mfix : mfixpoint term
idx, narg : nat
fn : term
Hf : match nth_error mfix idx with
| Some d =>
Some
(rarg d, subst0 (fix_subst mfix) (dbody d))
| None => None
end = Some (narg, fn)
Hwf : Ast.wf (tFix mfix idx)
Ast.wf fn
inv Hwf. mfix : mfixpoint term
idx, narg : nat
fn : term
Hf : match nth_error mfix idx with
| Some d =>
Some
(rarg d, subst0 (fix_subst mfix) (dbody d))
| None => None
end = Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
Ast.wf fn
destruct nth_error eqn :eqnth; try congruence .mfix : mfixpoint term
idx, narg : nat
fn : term
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some (rarg d, subst0 (fix_subst mfix) (dbody d)) =
Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
Ast.wf fn
pose proof (nth_error_forall eqnth H).mfix : mfixpoint term
idx, narg : nat
fn : term
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some (rarg d, subst0 (fix_subst mfix) (dbody d)) =
Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : (fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) d
Ast.wf fn
simpl in H0.mfix : mfixpoint term
idx, narg : nat
fn : term
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some (rarg d, subst0 (fix_subst mfix) (dbody d)) =
Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : Ast.wf (dtype d) /\ Ast.wf (dbody d)
Ast.wf fn
destruct H0 as [ _ wfd].mfix : mfixpoint term
idx, narg : nat
fn : term
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some (rarg d, subst0 (fix_subst mfix) (dbody d)) =
Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd : Ast.wf (dbody d)
Ast.wf fn
injection Hf.mfix : mfixpoint term
idx, narg : nat
fn : term
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some (rarg d, subst0 (fix_subst mfix) (dbody d)) =
Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd : Ast.wf (dbody d)
subst0 (fix_subst mfix) (dbody d) = fn ->
rarg d = narg -> Ast.wf fn
intros <- <-.mfix : mfixpoint term
idx : nat
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some (rarg d, subst0 (fix_subst mfix) (dbody d)) =
Some (rarg d, subst0 (fix_subst mfix) (dbody d))
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd : Ast.wf (dbody d)
Ast.wf (subst0 (fix_subst mfix) (dbody d))
apply wf_subst; auto .mfix : mfixpoint term
idx : nat
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some (rarg d, subst0 (fix_subst mfix) (dbody d)) =
Some (rarg d, subst0 (fix_subst mfix) (dbody d))
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd : Ast.wf (dbody d)
Forall Ast.wf (fix_subst mfix)
clear wfd Hf eqnth.mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
Forall Ast.wf (fix_subst mfix)
assert (forall n , Ast.wf (tFix mfix n)).mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
forall n : nat, Ast.wf (tFix mfix n)
constructor ; auto .mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : forall n : nat, Ast.wf (tFix mfix n)
Forall Ast.wf (fix_subst mfix)
unfold fix_subst.mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : forall n : nat, Ast.wf (tFix mfix n)
Forall Ast.wf
((fix aux (n : nat) : list term :=
match n with
| 0 => []
| S n0 => tFix mfix n0 :: aux n0
end ) #|mfix|)
generalize #|mfix|; intros .mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : forall n0 : nat, Ast.wf (tFix mfix n0)
n : nat
Forall Ast.wf
((fix aux (n0 : nat) :
list term :=
match n0 with
| 0 => []
| S n1 => tFix mfix n1 :: aux n1
end ) n)
induction n; auto .
Qed .
Lemma unfold_cofix_wf :
forall (mfix : mfixpoint term) (idx : nat) (narg : nat) (fn : term),
unfold_cofix mfix idx = Some (narg, fn) ->
Ast.wf (tCoFix mfix idx) -> Ast.wf fn.forall (mfix : mfixpoint term) (idx narg : nat)
(fn : term),
unfold_cofix mfix idx = Some (narg, fn) ->
Ast.wf (tCoFix mfix idx) -> Ast.wf fn
Proof .forall (mfix : mfixpoint term) (idx narg : nat)
(fn : term),
unfold_cofix mfix idx = Some (narg, fn) ->
Ast.wf (tCoFix mfix idx) -> Ast.wf fn
intros mfix idx narg fn Hf Hwf.mfix : mfixpoint term
idx, narg : nat
fn : term
Hf : unfold_cofix mfix idx = Some (narg, fn)
Hwf : Ast.wf (tCoFix mfix idx)
Ast.wf fn
unfold unfold_cofix in Hf.mfix : mfixpoint term
idx, narg : nat
fn : term
Hf : match nth_error mfix idx with
| Some d =>
Some
(rarg d,
subst0 (cofix_subst mfix) (dbody d))
| None => None
end = Some (narg, fn)
Hwf : Ast.wf (tCoFix mfix idx)
Ast.wf fn
inv Hwf. mfix : mfixpoint term
idx, narg : nat
fn : term
Hf : match nth_error mfix idx with
| Some d =>
Some
(rarg d,
subst0 (cofix_subst mfix) (dbody d))
| None => None
end = Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
Ast.wf fn
destruct nth_error eqn :eqnth; try congruence .mfix : mfixpoint term
idx, narg : nat
fn : term
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some
(rarg d, subst0 (cofix_subst mfix) (dbody d)) =
Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
Ast.wf fn
pose proof (nth_error_forall eqnth H).mfix : mfixpoint term
idx, narg : nat
fn : term
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some
(rarg d, subst0 (cofix_subst mfix) (dbody d)) =
Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : (fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) d
Ast.wf fn
simpl in H0.mfix : mfixpoint term
idx, narg : nat
fn : term
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some
(rarg d, subst0 (cofix_subst mfix) (dbody d)) =
Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : Ast.wf (dtype d) /\ Ast.wf (dbody d)
Ast.wf fn
injection Hf.mfix : mfixpoint term
idx, narg : nat
fn : term
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some
(rarg d, subst0 (cofix_subst mfix) (dbody d)) =
Some (narg, fn)
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : Ast.wf (dtype d) /\ Ast.wf (dbody d)
subst0 (cofix_subst mfix) (dbody d) = fn ->
rarg d = narg -> Ast.wf fn
intros <- <-.mfix : mfixpoint term
idx : nat
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some
(rarg d, subst0 (cofix_subst mfix) (dbody d)) =
Some
(rarg d, subst0 (cofix_subst mfix) (dbody d))
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : Ast.wf (dtype d) /\ Ast.wf (dbody d)
Ast.wf (subst0 (cofix_subst mfix) (dbody d))
destruct H0 as [ _ wfd ].mfix : mfixpoint term
idx : nat
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some
(rarg d, subst0 (cofix_subst mfix) (dbody d)) =
Some
(rarg d, subst0 (cofix_subst mfix) (dbody d))
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd : Ast.wf (dbody d)
Ast.wf (subst0 (cofix_subst mfix) (dbody d))
apply wf_subst; auto .mfix : mfixpoint term
idx : nat
d : def term
eqnth : nth_error mfix idx = Some d
Hf : Some
(rarg d, subst0 (cofix_subst mfix) (dbody d)) =
Some
(rarg d, subst0 (cofix_subst mfix) (dbody d))
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd : Ast.wf (dbody d)
Forall Ast.wf (cofix_subst mfix)
clear wfd Hf eqnth.mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
Forall Ast.wf (cofix_subst mfix)
assert (forall n , Ast.wf (tCoFix mfix n)).mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
forall n : nat, Ast.wf (tCoFix mfix n)
constructor ; auto .mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : forall n : nat, Ast.wf (tCoFix mfix n)
Forall Ast.wf (cofix_subst mfix)
unfold cofix_subst.mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : forall n : nat, Ast.wf (tCoFix mfix n)
Forall Ast.wf
((fix aux (n : nat) : list term :=
match n with
| 0 => []
| S n0 => tCoFix mfix n0 :: aux n0
end ) #|mfix|)
generalize #|mfix|; intros .mfix : mfixpoint term
idx : nat
d : def term
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0 : forall n0 : nat, Ast.wf (tCoFix mfix n0)
n : nat
Forall Ast.wf
((fix aux (n0 : nat) :
list term :=
match n0 with
| 0 => []
| S n1 => tCoFix mfix n1 :: aux n1
end ) n)
induction n; auto .
Qed .
Lemma wf_subst_instance u c :
Ast.wf c -> Ast.wf (subst_instance u c).Ast.wf c -> Ast.wf (subst_instance u c)
Proof .Ast.wf c -> Ast.wf (subst_instance u c)
induction 1 using term_wf_forall_list_ind; simpl ; try solve [ constructor ; auto using Forall_map ].u : Instance .t
t : term
H : isApp t = false
H0 : Ast.wf t
l : list term
H1 : l <> []
H2 : Forall Ast.wf l
H3 : Forall
(fun c : term => Ast.wf (subst_instance u c)) l
IHwf : Ast.wf (subst_instance u t)
Ast.wf (subst_instance u (tApp t l))
- u : Instance .t
t : term
H : isApp t = false
H0 : Ast.wf t
l : list term
H1 : l <> []
H2 : Forall Ast.wf l
H3 : Forall
(fun c : term => Ast.wf (subst_instance u c)) l
IHwf : Ast.wf (subst_instance u t)
Ast.wf (subst_instance u (tApp t l))
constructor ; auto .u : Instance .t
t : term
H : isApp t = false
H0 : Ast.wf t
l : list term
H1 : l <> []
H2 : Forall Ast.wf l
H3 : Forall
(fun c : term => Ast.wf (subst_instance u c)) l
IHwf : Ast.wf (subst_instance u t)
isApp
((fix
subst_instance_constr
(u0 : Instance .t) (c : term) {struct c} : term :=
match c with
| tEvar ev args =>
tEvar ev
(map (subst_instance_constr u0) args)
| tSort s => tSort (subst_instance_univ u0 s)
| tCast c0 kind ty =>
tCast (subst_instance_constr u0 c0) kind
(subst_instance_constr u0 ty)
| tProd na A B =>
tProd na (subst_instance_constr u0 A)
(subst_instance_constr u0 B)
| tLambda na T M =>
tLambda na (subst_instance_constr u0 T)
(subst_instance_constr u0 M)
| tLetIn na b ty b' =>
tLetIn na (subst_instance_constr u0 b)
(subst_instance_constr u0 ty)
(subst_instance_constr u0 b')
| tApp f v =>
tApp (subst_instance_constr u0 f)
(map (subst_instance_constr u0) v)
| tConst c0 u' =>
tConst c0 (subst_instance_instance u0 u')
| tInd i u' =>
tInd i (subst_instance_instance u0 u')
| tConstruct ind k u' =>
tConstruct ind k
(subst_instance_instance u0 u')
| tCase ind p c0 brs =>
let p' :=
map_predicate
(subst_instance_instance u0)
(subst_instance_constr u0)
(subst_instance_constr u0) p in
let brs' :=
map
(map_branch (subst_instance_constr u0))
brs in
tCase ind p' (subst_instance_constr u0 c0)
brs'
| tProj p c0 =>
tProj p (subst_instance_constr u0 c0)
| tFix mfix idx =>
let mfix' :=
map
(map_def (subst_instance_constr u0)
(subst_instance_constr u0)) mfix in
tFix mfix' idx
| tCoFix mfix idx =>
let mfix' :=
map
(map_def (subst_instance_constr u0)
(subst_instance_constr u0)) mfix in
tCoFix mfix' idx
| _ => c
end ) u t) = false
destruct t; simpl in *; try congruence .u : Instance .t
t : term
H : isApp t = false
H0 : Ast.wf t
l : list term
H1 : l <> []
H2 : Forall Ast.wf l
H3 : Forall
(fun c : term => Ast.wf (subst_instance u c)) l
IHwf : Ast.wf (subst_instance u t)
map
((fix
subst_instance_constr
(u0 : Instance .t) (c : term) {struct c} : term :=
match c with
| tEvar ev args =>
tEvar ev
(map (subst_instance_constr u0) args)
| tSort s => tSort (subst_instance_univ u0 s)
| tCast c0 kind ty =>
tCast (subst_instance_constr u0 c0) kind
(subst_instance_constr u0 ty)
| tProd na A B =>
tProd na (subst_instance_constr u0 A)
(subst_instance_constr u0 B)
| tLambda na T M =>
tLambda na (subst_instance_constr u0 T)
(subst_instance_constr u0 M)
| tLetIn na b ty b' =>
tLetIn na (subst_instance_constr u0 b)
(subst_instance_constr u0 ty)
(subst_instance_constr u0 b')
| tApp f v =>
tApp (subst_instance_constr u0 f)
(map (subst_instance_constr u0) v)
| tConst c0 u' =>
tConst c0 (subst_instance_instance u0 u')
| tInd i u' =>
tInd i (subst_instance_instance u0 u')
| tConstruct ind k u' =>
tConstruct ind k
(subst_instance_instance u0 u')
| tCase ind p c0 brs =>
let p' :=
map_predicate
(subst_instance_instance u0)
(subst_instance_constr u0)
(subst_instance_constr u0) p in
let brs' :=
map
(map_branch (subst_instance_constr u0))
brs in
tCase ind p' (subst_instance_constr u0 c0)
brs'
| tProj p c0 =>
tProj p (subst_instance_constr u0 c0)
| tFix mfix idx =>
let mfix' :=
map
(map_def (subst_instance_constr u0)
(subst_instance_constr u0)) mfix in
tFix mfix' idx
| tCoFix mfix idx =>
let mfix' :=
map
(map_def (subst_instance_constr u0)
(subst_instance_constr u0)) mfix in
tCoFix mfix' idx
| _ => c
end ) u) l <> []
destruct l; simpl in *; congruence .u : Instance .t
t : term
H : isApp t = false
H0 : Ast.wf t
l : list term
H1 : l <> []
H2 : Forall Ast.wf l
H3 : Forall
(fun c : term => Ast.wf (subst_instance u c)) l
IHwf : Ast.wf (subst_instance u t)
Forall Ast.wf
(map
((fix
subst_instance_constr
(u0 : Instance .t)
(c : term) {struct c} : term :=
match c with
| tEvar ev args =>
tEvar ev
(map (subst_instance_constr u0) args)
| tSort s => tSort (subst_instance_univ u0 s)
| tCast c0 kind ty =>
tCast (subst_instance_constr u0 c0) kind
(subst_instance_constr u0 ty)
| tProd na A B =>
tProd na (subst_instance_constr u0 A)
(subst_instance_constr u0 B)
| tLambda na T M =>
tLambda na (subst_instance_constr u0 T)
(subst_instance_constr u0 M)
| tLetIn na b ty b' =>
tLetIn na (subst_instance_constr u0 b)
(subst_instance_constr u0 ty)
(subst_instance_constr u0 b')
| tApp f v =>
tApp (subst_instance_constr u0 f)
(map (subst_instance_constr u0) v)
| tConst c0 u' =>
tConst c0 (subst_instance_instance u0 u')
| tInd i u' =>
tInd i (subst_instance_instance u0 u')
| tConstruct ind k u' =>
tConstruct ind k
(subst_instance_instance u0 u')
| tCase ind p c0 brs =>
let p' :=
map_predicate
(subst_instance_instance u0)
(subst_instance_constr u0)
(subst_instance_constr u0) p in
let brs' :=
map
(map_branch
(subst_instance_constr u0)) brs in
tCase ind p'
(subst_instance_constr u0 c0) brs'
| tProj p c0 =>
tProj p (subst_instance_constr u0 c0)
| tFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0)) mfix
in
tFix mfix' idx
| tCoFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0)) mfix
in
tCoFix mfix' idx
| _ => c
end ) u) l)
now apply Forall_map.
- u : Instance .t
ci : case_info
p0 : predicate term
X : tCasePredProp
(fun c : term => Ast.wf (subst_instance u c))
(fun c : term => Ast.wf (subst_instance u c)) p0
t : term
l : list (branch term)
X0 : tCaseBrsProp
(fun c : term => Ast.wf (subst_instance u c)) l
IHwf : Ast.wf (subst_instance u t)
Ast.wf (subst_instance u (tCase ci p0 t l))
constructor ; auto ; simpl ; solve_all.
- u : Instance .t
m : mfixpoint term
n : nat
X : tFixProp
(fun c : term => Ast.wf (subst_instance u c))
(fun c : term => Ast.wf (subst_instance u c)) m
Ast.wf (subst_instance u (tFix m n))
constructor .u : Instance .t
m : mfixpoint term
n : nat
X : tFixProp
(fun c : term => Ast.wf (subst_instance u c))
(fun c : term => Ast.wf (subst_instance u c)) m
Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
(map
(map_def
((fix
subst_instance_constr
(u0 : Instance .t)
(c : term) {struct c} : term :=
match c with
| tEvar ev args =>
tEvar ev
(map (subst_instance_constr u0) args)
| tSort s =>
tSort (subst_instance_univ u0 s)
| tCast c0 kind ty =>
tCast (subst_instance_constr u0 c0)
kind (subst_instance_constr u0 ty)
| tProd na A B =>
tProd na
(subst_instance_constr u0 A)
(subst_instance_constr u0 B)
| tLambda na T M =>
tLambda na
(subst_instance_constr u0 T)
(subst_instance_constr u0 M)
| tLetIn na b ty b' =>
tLetIn na
(subst_instance_constr u0 b)
(subst_instance_constr u0 ty)
(subst_instance_constr u0 b')
| tApp f v =>
tApp (subst_instance_constr u0 f)
(map (subst_instance_constr u0) v)
| tConst c0 u' =>
tConst c0
(subst_instance_instance u0 u')
| tInd i u' =>
tInd i (subst_instance_instance u0 u')
| tConstruct ind k u' =>
tConstruct ind k
(subst_instance_instance u0 u')
| tCase ind p c0 brs =>
let p' :=
map_predicate
(subst_instance_instance u0)
(subst_instance_constr u0)
(subst_instance_constr u0) p in
let brs' :=
map
(map_branch
(subst_instance_constr u0)) brs
in
tCase ind p'
(subst_instance_constr u0 c0) brs'
| tProj p c0 =>
tProj p (subst_instance_constr u0 c0)
| tFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0))
mfix in
tFix mfix' idx
| tCoFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0))
mfix in
tCoFix mfix' idx
| _ => c
end ) u)
((fix
subst_instance_constr
(u0 : Instance .t)
(c : term) {struct c} : term :=
match c with
| tEvar ev args =>
tEvar ev
(map (subst_instance_constr u0) args)
| tSort s =>
tSort (subst_instance_univ u0 s)
| tCast c0 kind ty =>
tCast (subst_instance_constr u0 c0)
kind (subst_instance_constr u0 ty)
| tProd na A B =>
tProd na
(subst_instance_constr u0 A)
(subst_instance_constr u0 B)
| tLambda na T M =>
tLambda na
(subst_instance_constr u0 T)
(subst_instance_constr u0 M)
| tLetIn na b ty b' =>
tLetIn na
(subst_instance_constr u0 b)
(subst_instance_constr u0 ty)
(subst_instance_constr u0 b')
| tApp f v =>
tApp (subst_instance_constr u0 f)
(map (subst_instance_constr u0) v)
| tConst c0 u' =>
tConst c0
(subst_instance_instance u0 u')
| tInd i u' =>
tInd i (subst_instance_instance u0 u')
| tConstruct ind k u' =>
tConstruct ind k
(subst_instance_instance u0 u')
| tCase ind p c0 brs =>
let p' :=
map_predicate
(subst_instance_instance u0)
(subst_instance_constr u0)
(subst_instance_constr u0) p in
let brs' :=
map
(map_branch
(subst_instance_constr u0)) brs
in
tCase ind p'
(subst_instance_constr u0 c0) brs'
| tProj p c0 =>
tProj p (subst_instance_constr u0 c0)
| tFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0))
mfix in
tFix mfix' idx
| tCoFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0))
mfix in
tCoFix mfix' idx
| _ => c
end ) u)) m)
solve_all.
- u : Instance .t
m : mfixpoint term
n : nat
X : tFixProp
(fun c : term => Ast.wf (subst_instance u c))
(fun c : term => Ast.wf (subst_instance u c)) m
Ast.wf (subst_instance u (tCoFix m n))
constructor .u : Instance .t
m : mfixpoint term
n : nat
X : tFixProp
(fun c : term => Ast.wf (subst_instance u c))
(fun c : term => Ast.wf (subst_instance u c)) m
Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
(map
(map_def
((fix
subst_instance_constr
(u0 : Instance .t)
(c : term) {struct c} : term :=
match c with
| tEvar ev args =>
tEvar ev
(map (subst_instance_constr u0) args)
| tSort s =>
tSort (subst_instance_univ u0 s)
| tCast c0 kind ty =>
tCast (subst_instance_constr u0 c0)
kind (subst_instance_constr u0 ty)
| tProd na A B =>
tProd na
(subst_instance_constr u0 A)
(subst_instance_constr u0 B)
| tLambda na T M =>
tLambda na
(subst_instance_constr u0 T)
(subst_instance_constr u0 M)
| tLetIn na b ty b' =>
tLetIn na
(subst_instance_constr u0 b)
(subst_instance_constr u0 ty)
(subst_instance_constr u0 b')
| tApp f v =>
tApp (subst_instance_constr u0 f)
(map (subst_instance_constr u0) v)
| tConst c0 u' =>
tConst c0
(subst_instance_instance u0 u')
| tInd i u' =>
tInd i (subst_instance_instance u0 u')
| tConstruct ind k u' =>
tConstruct ind k
(subst_instance_instance u0 u')
| tCase ind p c0 brs =>
let p' :=
map_predicate
(subst_instance_instance u0)
(subst_instance_constr u0)
(subst_instance_constr u0) p in
let brs' :=
map
(map_branch
(subst_instance_constr u0)) brs
in
tCase ind p'
(subst_instance_constr u0 c0) brs'
| tProj p c0 =>
tProj p (subst_instance_constr u0 c0)
| tFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0))
mfix in
tFix mfix' idx
| tCoFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0))
mfix in
tCoFix mfix' idx
| _ => c
end ) u)
((fix
subst_instance_constr
(u0 : Instance .t)
(c : term) {struct c} : term :=
match c with
| tEvar ev args =>
tEvar ev
(map (subst_instance_constr u0) args)
| tSort s =>
tSort (subst_instance_univ u0 s)
| tCast c0 kind ty =>
tCast (subst_instance_constr u0 c0)
kind (subst_instance_constr u0 ty)
| tProd na A B =>
tProd na
(subst_instance_constr u0 A)
(subst_instance_constr u0 B)
| tLambda na T M =>
tLambda na
(subst_instance_constr u0 T)
(subst_instance_constr u0 M)
| tLetIn na b ty b' =>
tLetIn na
(subst_instance_constr u0 b)
(subst_instance_constr u0 ty)
(subst_instance_constr u0 b')
| tApp f v =>
tApp (subst_instance_constr u0 f)
(map (subst_instance_constr u0) v)
| tConst c0 u' =>
tConst c0
(subst_instance_instance u0 u')
| tInd i u' =>
tInd i (subst_instance_instance u0 u')
| tConstruct ind k u' =>
tConstruct ind k
(subst_instance_instance u0 u')
| tCase ind p c0 brs =>
let p' :=
map_predicate
(subst_instance_instance u0)
(subst_instance_constr u0)
(subst_instance_constr u0) p in
let brs' :=
map
(map_branch
(subst_instance_constr u0)) brs
in
tCase ind p'
(subst_instance_constr u0 c0) brs'
| tProj p c0 =>
tProj p (subst_instance_constr u0 c0)
| tFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0))
mfix in
tFix mfix' idx
| tCoFix mfix idx =>
let mfix' :=
map
(map_def
(subst_instance_constr u0)
(subst_instance_constr u0))
mfix in
tCoFix mfix' idx
| _ => c
end ) u)) m)
solve_all.
Qed .
Lemma wf_nth :
forall (n : nat) (args : list term), Forall Ast.wf args -> Ast.wf (nth n args tDummy).forall (n : nat) (args : list term),
Forall Ast.wf args -> Ast.wf (nth n args tDummy)
Proof .forall (n : nat) (args : list term),
Forall Ast.wf args -> Ast.wf (nth n args tDummy)
intros n args H.n : nat
args : list term
H : Forall Ast.wf args
Ast.wf (nth n args tDummy)
induction H in n; destruct n; simpl ; try constructor ; auto .
Qed .
Hint Resolve wf_nth : core.
Lemma red1_isLambda Σ Γ t u :
red1 Σ Γ t u -> isLambda t -> isLambda u.Σ : global_env
Γ : context
t, u : term
red1 Σ Γ t u -> isLambda t -> isLambda u
Proof .Σ : global_env
Γ : context
t, u : term
red1 Σ Γ t u -> isLambda t -> isLambda u
induction 1 using red1_ind_all; simpl ; try discriminate ; auto .
Qed .
Lemma OnOne2_All_All {A } {P Q } {l l' : list A} :
OnOne2 P l l' ->
(forall x y , P x y -> Q x -> Q y) ->
All Q l -> All Q l'.A : Type
P : A -> A -> Type
Q : A -> Type
l, l' : list A
OnOne2 P l l' ->
(forall x y : A, P x y -> Q x -> Q y) ->
All Q l -> All Q l'
Proof .A : Type
P : A -> A -> Type
Q : A -> Type
l, l' : list A
OnOne2 P l l' ->
(forall x y : A, P x y -> Q x -> Q y) ->
All Q l -> All Q l'
intros Hl H.A : Type
P : A -> A -> Type
Q : A -> Type
l, l' : list A
Hl : OnOne2 P l l'
H : forall x y : A, P x y -> Q x -> Q y
All Q l -> All Q l'
induction Hl; intros H'; inv H'; constructor ; eauto . Qed .
Lemma All_mapi {A B } (P : B -> Type ) (l : list A) (f : nat -> A -> B) :
Alli (fun i x => P (f i x)) 0 l -> All P (mapi f l).A, B : Type
P : B -> Type
l : list A
f : nat -> A -> B
Alli (fun (i : nat) (x : A) => P (f i x)) 0 l ->
All P (mapi f l)
Proof .A, B : Type
P : B -> Type
l : list A
f : nat -> A -> B
Alli (fun (i : nat) (x : A) => P (f i x)) 0 l ->
All P (mapi f l)
unfold mapi.A, B : Type
P : B -> Type
l : list A
f : nat -> A -> B
Alli (fun (i : nat) (x : A) => P (f i x)) 0 l ->
All P (mapi_rec f l 0 )
generalize 0 .A, B : Type
P : B -> Type
l : list A
f : nat -> A -> B
forall n : nat,
Alli (fun (i : nat) (x : A) => P (f i x)) n l ->
All P (mapi_rec f l n)
induction 1 ; constructor ; auto .
Qed .
Lemma Alli_id {A } (P : nat -> A -> Type ) n (l : list A) :
(forall n x , P n x) -> Alli P n l.A : Type
P : nat -> A -> Type
n : nat
l : list A
(forall (n0 : nat) (x : A), P n0 x) -> Alli P n l
Proof .A : Type
P : nat -> A -> Type
n : nat
l : list A
(forall (n0 : nat) (x : A), P n0 x) -> Alli P n l
intros H.A : Type
P : nat -> A -> Type
n : nat
l : list A
H : forall (n0 : nat) (x : A), P n0 x
Alli P n l
induction l in n |- *; constructor ; auto .
Qed .
Lemma All_Alli {A } {P : A -> Type } {Q : nat -> A -> Type } {l n } :
All P l ->
(forall n x , P x -> Q n x) ->
Alli Q n l.A : Type
P : A -> Type
Q : nat -> A -> Type
l : list A
n : nat
All P l ->
(forall (n0 : nat) (x : A), P x -> Q n0 x) ->
Alli Q n l
Proof .A : Type
P : A -> Type
Q : nat -> A -> Type
l : list A
n : nat
All P l ->
(forall (n0 : nat) (x : A), P x -> Q n0 x) ->
Alli Q n l
intro H.A : Type
P : A -> Type
Q : nat -> A -> Type
l : list A
n : nat
H : All P l
(forall (n0 : nat) (x : A), P x -> Q n0 x) ->
Alli Q n l
revert n.A : Type
P : A -> Type
Q : nat -> A -> Type
l : list A
H : All P l
forall n : nat,
(forall (n0 : nat) (x : A), P x -> Q n0 x) ->
Alli Q n l
induction H; constructor ; eauto . Qed .
Ltac wf := intuition try (eauto with wf || congruence || solve [constructor ]).
Hint Unfold wf_decl vass vdef : wf .
Hint Extern 10 => progress simpl : wf .
Hint Unfold snoc : wf .
Hint Extern 3 => apply wf_lift || apply wf_subst || apply wf_subst_instance : wf .
Hint Extern 10 => constructor : wf .
Hint Resolve All_skipn : wf .
Lemma declared_inductive_wf {cf :checker_flags} :
forall (Σ : global_env) ind
(mdecl : mutual_inductive_body) (idecl : one_inductive_body),
Forall_decls_typing (fun (_ : global_env_ext) (_ : context ) (t T : term) => Ast.wf t /\ Ast.wf T) Σ ->
declared_inductive Σ ind mdecl idecl -> Ast.wf (ind_type idecl).forall (Σ : global_env) (ind : inductive)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_inductive Σ ind mdecl idecl ->
Ast.wf (ind_type idecl)
Proof .forall (Σ : global_env) (ind : inductive)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_inductive Σ ind mdecl idecl ->
Ast.wf (ind_type idecl)
intros .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
H : declared_inductive Σ ind mdecl idecl
Ast.wf (ind_type idecl)
destruct H as [Hmdecl Hidecl].cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Hmdecl : declared_minductive Σ (inductive_mind ind)
mdecl
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Ast.wf (ind_type idecl)
red in Hmdecl.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Ast.wf (ind_type idecl)
eapply lookup_on_global_env in X as [Σ' [wfΣ' prf]]; eauto .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_global_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) (InductiveDecl mdecl)
Ast.wf (ind_type idecl)
apply onInductives in prf.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Ast.wf (ind_type idecl)
eapply nth_error_alli in Hidecl; eauto .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
Ast.wf (ind_type idecl)
eapply onArity in Hidecl.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_type
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' []
(ind_type idecl)
Ast.wf (ind_type idecl)
destruct Hidecl as [s Hs]; wf .
Qed .
Lemma it_mkProd_or_LetIn_wf Γ t
: Ast.wf (it_mkProd_or_LetIn Γ t) -> Forall wf_decl Γ /\ Ast.wf t.Ast.wf (it_mkProd_or_LetIn Γ t) ->
Forall wf_decl Γ /\ Ast.wf t
Proof .Ast.wf (it_mkProd_or_LetIn Γ t) ->
Forall wf_decl Γ /\ Ast.wf t
revert t.forall t : term,
Ast.wf (it_mkProd_or_LetIn Γ t) ->
Forall wf_decl Γ /\ Ast.wf t
induction Γ; [simpl ; auto with wf |].a : context_decl
Γ : list context_decl
IHΓ : forall t : term,
Ast.wf (it_mkProd_or_LetIn Γ t) -> Forall wf_decl Γ /\ Ast.wf t
forall t : term,
Ast.wf (it_mkProd_or_LetIn (a :: Γ) t) ->
Forall wf_decl (a :: Γ) /\ Ast.wf t
intros t XX.a : context_decl
Γ : list context_decl
IHΓ : forall t0 : term,
Ast.wf (it_mkProd_or_LetIn Γ t0) -> Forall wf_decl Γ /\ Ast.wf t0
t : term
XX : Ast.wf (it_mkProd_or_LetIn (a :: Γ) t)
Forall wf_decl (a :: Γ) /\ Ast.wf t
destruct a, decl_body; simpl in *.decl_name : aname
t0, decl_type : term
Γ : list context_decl
IHΓ : forall t1 : term,
Ast.wf (it_mkProd_or_LetIn Γ t1) ->
Forall wf_decl Γ /\ Ast.wf t1
t : term
XX : Ast.wf
(it_mkProd_or_LetIn Γ
(mkProd_or_LetIn
{|
decl_name := decl_name;
decl_body := Some t0;
decl_type := decl_type |} t))
Forall wf_decl
({|
decl_name := decl_name;
decl_body := Some t0;
decl_type := decl_type |} :: Γ) /\ Ast.wf t
apply IHΓ in XX as [].decl_name : aname
t0, decl_type : term
Γ : list context_decl
IHΓ : forall t1 : term,
Ast.wf (it_mkProd_or_LetIn Γ t1) ->
Forall wf_decl Γ /\ Ast.wf t1
t : term
H : Forall wf_decl Γ
H0 : Ast.wf
(mkProd_or_LetIn
{|
decl_name := decl_name;
decl_body := Some t0;
decl_type := decl_type |} t)
Forall wf_decl
({|
decl_name := decl_name;
decl_body := Some t0;
decl_type := decl_type |} :: Γ) /\
Ast.wf t
depelim H0; simpl in *; split ; auto with wf . decl_name : aname
decl_type : term
Γ : list context_decl
IHΓ : forall t0 : term,
Ast.wf (it_mkProd_or_LetIn Γ t0) ->
Forall wf_decl Γ /\ Ast.wf t0
t : term
XX : Ast.wf
(it_mkProd_or_LetIn Γ
(mkProd_or_LetIn
{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |} t))
Forall wf_decl
({|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |} :: Γ) /\
Ast.wf t
apply IHΓ in XX as [].decl_name : aname
decl_type : term
Γ : list context_decl
IHΓ : forall t0 : term,
Ast.wf (it_mkProd_or_LetIn Γ t0) ->
Forall wf_decl Γ /\ Ast.wf t0
t : term
H : Forall wf_decl Γ
H0 : Ast.wf
(mkProd_or_LetIn
{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |} t)
Forall wf_decl
({|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |} :: Γ) /\
Ast.wf t
depelim H0. decl_name : aname
decl_type : term
Γ : list context_decl
IHΓ : forall t0 : term,
Ast.wf (it_mkProd_or_LetIn Γ t0) ->
Forall wf_decl Γ /\ Ast.wf t0
t : term
H : Forall wf_decl Γ
H0_ : Ast.wf
(BasicAst.decl_type
{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |})
H0_0 : Ast.wf t
Forall wf_decl
({|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |} :: Γ) /\
Ast.wf t
simpl in *.decl_name : aname
decl_type : term
Γ : list context_decl
IHΓ : forall t0 : term,
Ast.wf (it_mkProd_or_LetIn Γ t0) ->
Forall wf_decl Γ /\ Ast.wf t0
t : term
H : Forall wf_decl Γ
H0_ : Ast.wf decl_type
H0_0 : Ast.wf t
Forall wf_decl
({|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |} :: Γ) /\
Ast.wf t
split ; auto .decl_name : aname
decl_type : term
Γ : list context_decl
IHΓ : forall t0 : term,
Ast.wf (it_mkProd_or_LetIn Γ t0) ->
Forall wf_decl Γ /\ Ast.wf t0
t : term
H : Forall wf_decl Γ
H0_ : Ast.wf decl_type
H0_0 : Ast.wf t
Forall wf_decl
({|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |} :: Γ)
constructor ; auto with wf .
Qed .
Lemma declared_inductive_wf_indices {cf :checker_flags} :
forall (Σ : global_env) ind
(mdecl : mutual_inductive_body) (idecl : one_inductive_body),
Forall_decls_typing (fun (_ : global_env_ext) (_ : context ) (t T : term) => Ast.wf t /\ Ast.wf T) Σ ->
declared_inductive Σ ind mdecl idecl -> Forall wf_decl (ind_indices idecl).forall (Σ : global_env) (ind : inductive)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall wf_decl (ind_indices idecl)
Proof .forall (Σ : global_env) (ind : inductive)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall wf_decl (ind_indices idecl)
intros .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
H : declared_inductive Σ ind mdecl idecl
Forall wf_decl (ind_indices idecl)
destruct H as [Hmdecl Hidecl].cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Hmdecl : declared_minductive Σ (inductive_mind ind)
mdecl
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Forall wf_decl (ind_indices idecl)
red in Hmdecl.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Forall wf_decl (ind_indices idecl)
eapply lookup_on_global_env in X as [Σ' [wfΣ' prf]]; eauto .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_global_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) (InductiveDecl mdecl)
Forall wf_decl (ind_indices idecl)
apply onInductives in prf.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Forall wf_decl (ind_indices idecl)
eapply nth_error_alli in Hidecl; eauto .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
Forall wf_decl (ind_indices idecl)
pose proof (onArity Hidecl).cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
X : on_type
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' []
(ind_type idecl)
Forall wf_decl (ind_indices idecl)
rewrite Hidecl.(ind_arity_eq) in X.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
X : on_type
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' []
(it_mkProd_or_LetIn (ind_params mdecl)
(it_mkProd_or_LetIn
(ind_indices idecl)
(tSort (ind_sort idecl))))
Forall wf_decl (ind_indices idecl)
destruct X as [s Hs]; wf .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
s : Universe .t
H : Ast.wf
(it_mkProd_or_LetIn (ind_params mdecl)
(it_mkProd_or_LetIn
(ind_indices idecl)
(tSort (ind_sort idecl))))
H0 : Ast.wf (tSort s)
Forall wf_decl (ind_indices idecl)
eapply it_mkProd_or_LetIn_wf in H as [? H].cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
s : Universe .t
H0 : Ast.wf (tSort s)
H1 : Forall wf_decl (ind_params mdecl)
H : Ast.wf
(it_mkProd_or_LetIn (ind_indices idecl)
(tSort (ind_sort idecl)))
Forall wf_decl (ind_indices idecl)
now eapply it_mkProd_or_LetIn_wf in H.
Qed .
Lemma declared_inductive_wf_ctors {cf :checker_flags} :
forall (Σ : global_env) ind
(mdecl : mutual_inductive_body) (idecl : one_inductive_body),
Forall_decls_typing (fun (_ : global_env_ext) (_ : context ) (t T : term) => Ast.wf t /\ Ast.wf T) Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall (fun ctor => Forall wf_decl ctor.(cstr_args)) (ind_ctors idecl).forall (Σ : global_env) (ind : inductive)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
Proof .forall (Σ : global_env) (ind : inductive)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
intros .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
H : declared_inductive Σ ind mdecl idecl
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
destruct H as [Hmdecl Hidecl].cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Hmdecl : declared_minductive Σ (inductive_mind ind)
mdecl
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
red in Hmdecl.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
eapply lookup_on_global_env in X as [Σ' [wfΣ' prf]]; eauto .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_global_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) (InductiveDecl mdecl)
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
apply onInductives in prf.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
eapply nth_error_alli in Hidecl; eauto .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
pose proof (onConstructors Hidecl).cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
X : on_constructors
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' mdecl
(0 + inductive_ind ind) idecl
(ind_indices idecl) (ind_ctors idecl)
(ind_cunivs Hidecl)
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
red in X.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
X : All2
(on_constructor
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' mdecl
(0 + inductive_ind ind) idecl
(ind_indices idecl))
(ind_ctors idecl) (ind_cunivs Hidecl)
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
solve_all. cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
x : constructor_body
y : list Universe .t
X : on_constructor
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' mdecl
(inductive_ind ind) idecl
(ind_indices idecl) x y
All wf_decl (cstr_args x)
destruct X.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(0 + inductive_ind ind) idecl
x : constructor_body
y : list Universe .t
cstr_args_length : context_assumptions (cstr_args x) =
cstr_arity x
cstr_eq : cstr_type x =
it_mkProd_or_LetIn (ind_params mdecl)
(it_mkProd_or_LetIn (cstr_args x)
(cstr_concl mdecl (inductive_ind ind)
idecl x))
on_ctype : on_type
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl))
(cstr_type x)
on_cargs : sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) (cstr_args x) y
on_cindices : TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T0 : term) =>
Ast.wf t0 /\ Ast.wf T0) Σ0 Γ t
(Some T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl,,, cstr_args x)
(cstr_indices x)
(List.rev
(lift_context #|cstr_args x| 0
(ind_indices idecl)))
on_ctype_positive : positive_cstr mdecl
(inductive_ind ind) []
(cstr_type x)
on_ctype_variance : forall v : list Variance.t,
ind_variance mdecl = Some v ->
cstr_respects_variance Σ' mdecl v
x
All wf_decl (cstr_args x)
clear -on_cargs.mdecl : mutual_inductive_body
Σ' : global_env * universes_decl
x : constructor_body
y : list Universe .t
on_cargs : sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) (cstr_args x) y
All wf_decl (cstr_args x)
induction (cstr_args x) as [|[na [b|] ty] args] in on_cargs, y |- * ;
try destruct on_cargs;
constructor ; intuition eauto ; simpl in *.mdecl : mutual_inductive_body
Σ' : global_env * universes_decl
x : constructor_body
y : list Universe .t
na : aname
ty : term
args : list context_decl
on_cargs : match y with
| [] => False
| u :: us =>
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args us *
(Ast.wf ty /\ Ast.wf (tSort u))
end
IHargs : forall y0 : list Universe .t,
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y0 ->
All wf_decl args
wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
red .mdecl : mutual_inductive_body
Σ' : global_env * universes_decl
x : constructor_body
y : list Universe .t
na : aname
ty : term
args : list context_decl
on_cargs : match y with
| [] => False
| u :: us =>
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args us *
(Ast.wf ty /\ Ast.wf (tSort u))
end
IHargs : forall y0 : list Universe .t,
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y0 ->
All wf_decl args
match
decl_body
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
with
| Some b => Ast.wf b
| None => True
end /\
Ast.wf
(decl_type
{|
decl_name := na;
decl_body := None;
decl_type := ty |})
simpl .mdecl : mutual_inductive_body
Σ' : global_env * universes_decl
x : constructor_body
y : list Universe .t
na : aname
ty : term
args : list context_decl
on_cargs : match y with
| [] => False
| u :: us =>
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args us *
(Ast.wf ty /\ Ast.wf (tSort u))
end
IHargs : forall y0 : list Universe .t,
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y0 ->
All wf_decl args
True /\ Ast.wf ty
destruct y => //.mdecl : mutual_inductive_body
Σ' : global_env * universes_decl
x : constructor_body
t : Universe .t
y : list Universe .t
na : aname
ty : term
args : list context_decl
on_cargs : sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T : term) =>
Ast.wf t0 /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y *
(Ast.wf ty /\ Ast.wf (tSort t))
IHargs : forall y0 : list Universe .t,
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T : term) =>
Ast.wf t0 /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y0 ->
All wf_decl args
True /\ Ast.wf ty
intuition auto .mdecl : mutual_inductive_body
Σ' : global_env * universes_decl
x : constructor_body
y : list Universe .t
na : aname
ty : term
args : list context_decl
on_cargs : match y with
| [] => False
| u :: us =>
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args us *
(Ast.wf ty /\ Ast.wf (tSort u))
end
IHargs : forall y0 : list Universe .t,
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y0 ->
All wf_decl args
All wf_decl args
destruct y => //.mdecl : mutual_inductive_body
Σ' : global_env * universes_decl
x : constructor_body
t : Universe .t
y : list Universe .t
na : aname
ty : term
args : list context_decl
on_cargs : sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T : term) =>
Ast.wf t0 /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y *
(Ast.wf ty /\ Ast.wf (tSort t))
IHargs : forall y0 : list Universe .t,
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T : term) =>
Ast.wf t0 /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y0 ->
All wf_decl args
All wf_decl args
eapply IHargs.mdecl : mutual_inductive_body
Σ' : global_env * universes_decl
x : constructor_body
t : Universe .t
y : list Universe .t
na : aname
ty : term
args : list context_decl
on_cargs : sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T : term) =>
Ast.wf t0 /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y *
(Ast.wf ty /\ Ast.wf (tSort t))
IHargs : forall y0 : list Universe .t,
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T : term) =>
Ast.wf t0 /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args y0 ->
All wf_decl args
sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T : term) =>
Ast.wf t0 /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) args
?y
intuition eauto .
Qed .
Lemma All_local_env_wf_decls ctx :
TemplateEnvTyping.All_local_env wf_decl_pred ctx ->
Forall wf_decl ctx.TemplateEnvTyping.All_local_env wf_decl_pred ctx ->
Forall wf_decl ctx
Proof .TemplateEnvTyping.All_local_env wf_decl_pred ctx ->
Forall wf_decl ctx
induction 1 ; constructor ; auto .Γ : context
na : aname
t : term
X : TemplateEnvTyping.All_local_env wf_decl_pred Γ
t0 : wf_decl_pred Γ t None
IHX : Forall wf_decl Γ
wf_decl (vass na t)
destruct t0 as [s Hs].Γ : context
na : aname
t : term
X : TemplateEnvTyping.All_local_env wf_decl_pred Γ
s : Ast.wf t
Hs : True
IHX : Forall wf_decl Γ
wf_decl (vass na t)
split ; simpl ; intuition auto .
Qed .
Lemma declared_inductive_wf_params {cf :checker_flags} :
forall (Σ : global_env) ind
(mdecl : mutual_inductive_body) (idecl : one_inductive_body),
on_global_env (fun Σ => wf_decl_pred) Σ ->
declared_inductive Σ ind mdecl idecl -> Forall wf_decl (ind_params mdecl).forall (Σ : global_env) (ind : inductive)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body),
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall wf_decl (ind_params mdecl)
Proof .forall (Σ : global_env) (ind : inductive)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body),
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall wf_decl (ind_params mdecl)
intros .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
H : declared_inductive Σ ind mdecl idecl
Forall wf_decl (ind_params mdecl)
destruct H as [Hmdecl Hidecl].cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Hmdecl : declared_minductive Σ (inductive_mind ind)
mdecl
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Forall wf_decl (ind_params mdecl)
red in Hmdecl.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
X : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Forall wf_decl (ind_params mdecl)
eapply lookup_on_global_env in X as [Σ' [wfΣ' prf]]; eauto .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf : on_global_decl
(fun _ : global_env_ext => wf_decl_pred) Σ'
(inductive_mind ind) (InductiveDecl mdecl)
Forall wf_decl (ind_params mdecl)
apply onParams in prf.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf : on_context
(fun _ : global_env_ext => wf_decl_pred) Σ'
(ind_params mdecl)
Forall wf_decl (ind_params mdecl)
red in prf.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind ind) =
Some idecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf : TemplateEnvTyping.All_local_env wf_decl_pred
(ind_params mdecl)
Forall wf_decl (ind_params mdecl)
now apply All_local_env_wf_decls in prf.
Qed .
Lemma declared_constructor_wf {cf :checker_flags}:
forall (Σ : global_env) (ind : inductive) (i : nat) (u : list Level.t)
(mdecl : mutual_inductive_body) (idecl : one_inductive_body) (cdecl : constructor_body),
Forall_decls_typing (fun (_ : global_env_ext) (_ : context ) (t T : term) => Ast.wf t /\ Ast.wf T) Σ ->
declared_constructor Σ (ind, i) mdecl idecl cdecl ->
Ast.wf (cstr_type cdecl).forall (Σ : global_env) (ind : inductive) (i : nat),
list Level.t ->
forall (mdecl : mutual_inductive_body)
(idecl : one_inductive_body)
(cdecl : constructor_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_constructor Σ (ind, i) mdecl idecl cdecl ->
Ast.wf (cstr_type cdecl)
Proof .forall (Σ : global_env) (ind : inductive) (i : nat),
list Level.t ->
forall (mdecl : mutual_inductive_body)
(idecl : one_inductive_body)
(cdecl : constructor_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_constructor Σ (ind, i) mdecl idecl cdecl ->
Ast.wf (cstr_type cdecl)
intros Σ ind i u mdecl idecl cdecl X isdecl.cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
isdecl : declared_constructor Σ (ind, i) mdecl idecl
cdecl
Ast.wf (cstr_type cdecl)
destruct isdecl as [[Hmdecl Hidecl] Hcdecl].cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Hmdecl : declared_minductive Σ
(inductive_mind (ind, i).1 ) mdecl
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind (ind, i).1 ) =
Some idecl
Hcdecl : nth_error (ind_ctors idecl) (ind, i).2 =
Some cdecl
Ast.wf (cstr_type cdecl)
red in Hmdecl.cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Hmdecl : lookup_env Σ (inductive_mind (ind, i).1 ) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind (ind, i).1 ) =
Some idecl
Hcdecl : nth_error (ind_ctors idecl) (ind, i).2 =
Some cdecl
Ast.wf (cstr_type cdecl)
eapply lookup_on_global_env in X as [Σ' [wfΣ' prf]]; eauto .cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind (ind, i).1 ) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind (ind, i).1 ) =
Some idecl
Hcdecl : nth_error (ind_ctors idecl) (ind, i).2 =
Some cdecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_global_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind (ind, i).1 )
(InductiveDecl mdecl)
Ast.wf (cstr_type cdecl)
red in prf.cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind (ind, i).1 ) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind (ind, i).1 ) =
Some idecl
Hcdecl : nth_error (ind_ctors idecl) (ind, i).2 =
Some cdecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_inductive
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind (ind, i).1 ) mdecl
Ast.wf (cstr_type cdecl)
apply onInductives in prf.cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind (ind, i).1 ) =
Some (InductiveDecl mdecl)
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind (ind, i).1 ) =
Some idecl
Hcdecl : nth_error (ind_ctors idecl) (ind, i).2 =
Some cdecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind (ind, i).1 ) mdecl) 0
(ind_bodies mdecl)
Ast.wf (cstr_type cdecl)
eapply nth_error_alli in Hidecl; eauto .cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind (ind, i).1 ) =
Some (InductiveDecl mdecl)
Hcdecl : nth_error (ind_ctors idecl) (ind, i).2 =
Some cdecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind (ind, i).1 ) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind (ind, i).1 ) mdecl
(0 + inductive_ind (ind, i).1 ) idecl
Ast.wf (cstr_type cdecl)
simpl in *.cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hcdecl : nth_error (ind_ctors idecl) i = Some cdecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
Ast.wf (cstr_type cdecl)
pose proof (onConstructors Hidecl) as h.cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hcdecl : nth_error (ind_ctors idecl) i = Some cdecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
h : on_constructors
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' mdecl
(inductive_ind ind) idecl
(ind_indices idecl) (ind_ctors idecl)
(ind_cunivs Hidecl)
Ast.wf (cstr_type cdecl)
unfold on_constructors in h.cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Hcdecl : nth_error (ind_ctors idecl) i = Some cdecl
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
h : All2
(on_constructor
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' mdecl
(inductive_ind ind) idecl
(ind_indices idecl))
(ind_ctors idecl) (ind_cunivs Hidecl)
Ast.wf (cstr_type cdecl)
eapply All2_nth_error_Some in Hcdecl.cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
h : All2
(on_constructor
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' mdecl
(inductive_ind ind) idecl
(ind_indices idecl))
(ind_ctors idecl) (ind_cunivs Hidecl)
Hcdecl : ∑ t' : ?B ,
nth_error ?l' i = Some t' × ?P cdecl t'
Ast.wf (cstr_type cdecl)
2 : eassumption .cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
h : All2
(on_constructor
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' mdecl
(inductive_ind ind) idecl
(ind_indices idecl))
(ind_ctors idecl) (ind_cunivs Hidecl)
Hcdecl : ∑ t' : list Universe .t,
nth_error (ind_cunivs Hidecl) i = Some t'
× on_constructor
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' mdecl
(inductive_ind ind) idecl
(ind_indices idecl) cdecl t'
Ast.wf (cstr_type cdecl)
destruct Hcdecl as [cs [Hnth [? ? [? [? ?]] ?]]].cf : checker_flags
Σ : global_env
ind : inductive
i : nat
u : list Level.t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
Hmdecl : lookup_env Σ (inductive_mind ind) =
Some (InductiveDecl mdecl)
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
h : All2
(on_constructor
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' mdecl
(inductive_ind ind) idecl
(ind_indices idecl))
(ind_ctors idecl) (ind_cunivs Hidecl)
cs : list Universe .t
Hnth : nth_error (ind_cunivs Hidecl) i = Some cs
cstr_args_length : context_assumptions
(cstr_args cdecl) =
cstr_arity cdecl
cstr_eq : cstr_type cdecl =
it_mkProd_or_LetIn (ind_params mdecl)
(it_mkProd_or_LetIn (cstr_args cdecl)
(cstr_concl mdecl (inductive_ind ind)
idecl cdecl))
x : Universe .t
H : Ast.wf (cstr_type cdecl)
H0 : Ast.wf (tSort x)
on_cargs : sorts_local_ctx
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) (cstr_args cdecl) cs
on_cindices : TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T0 : term) =>
Ast.wf t0 /\ Ast.wf T0) Σ0 Γ t
(Some T)) Σ'
(arities_context (ind_bodies mdecl),,,
ind_params mdecl,,, cstr_args cdecl)
(cstr_indices cdecl)
(List.rev
(lift_context #|cstr_args cdecl| 0
(ind_indices idecl)))
on_ctype_positive : positive_cstr mdecl
(inductive_ind ind) []
(cstr_type cdecl)
on_ctype_variance : forall v : list Variance.t,
ind_variance mdecl = Some v ->
cstr_respects_variance Σ' mdecl v
cdecl
Ast.wf (cstr_type cdecl)
assumption .
Qed .
Lemma destArity_spec ctx T :
match destArity ctx T with
| Some (ctx', s) => it_mkProd_or_LetIn ctx T = it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end .ctx : list context_decl
T : term
match destArity ctx T with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx T =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
Proof .ctx : list context_decl
T : term
match destArity ctx T with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx T =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
induction T in ctx |- *; simpl ; try easy .ctx : list context_decl
na : aname
T1, T2 : term
IHT1 : forall ctx0 : list context_decl,
match destArity ctx0 T1 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T1 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
IHT2 : forall ctx0 : list context_decl,
match destArity ctx0 T2 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T2 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
match destArity (ctx,, vass na T1) T2 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx (tProd na T1 T2) =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
- ctx : list context_decl
na : aname
T1, T2 : term
IHT1 : forall ctx0 : list context_decl,
match destArity ctx0 T1 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T1 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
IHT2 : forall ctx0 : list context_decl,
match destArity ctx0 T2 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T2 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
match destArity (ctx,, vass na T1) T2 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx (tProd na T1 T2) =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
specialize (IHT2 (ctx,, vass na T1)).ctx : list context_decl
na : aname
T1, T2 : term
IHT1 : forall ctx0 : list context_decl,
match destArity ctx0 T1 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T1 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
IHT2 : match destArity (ctx,, vass na T1) T2 with
| Some (ctx', s) =>
it_mkProd_or_LetIn (ctx,, vass na T1) T2 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
match destArity (ctx,, vass na T1) T2 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx (tProd na T1 T2) =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
now destruct destArity.
- ctx : list context_decl
na : aname
T1, T2, T3 : term
IHT1 : forall ctx0 : list context_decl,
match destArity ctx0 T1 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T1 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
IHT2 : forall ctx0 : list context_decl,
match destArity ctx0 T2 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T2 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
IHT3 : forall ctx0 : list context_decl,
match destArity ctx0 T3 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T3 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
match destArity (ctx,, vdef na T1 T2) T3 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx (tLetIn na T1 T2 T3) =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
specialize (IHT3 (ctx,, vdef na T1 T2)).ctx : list context_decl
na : aname
T1, T2, T3 : term
IHT1 : forall ctx0 : list context_decl,
match destArity ctx0 T1 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T1 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
IHT2 : forall ctx0 : list context_decl,
match destArity ctx0 T2 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx0 T2 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
IHT3 : match destArity (ctx,, vdef na T1 T2) T3 with
| Some (ctx', s) =>
it_mkProd_or_LetIn (ctx,, vdef na T1 T2) T3 =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
match destArity (ctx,, vdef na T1 T2) T3 with
| Some (ctx', s) =>
it_mkProd_or_LetIn ctx (tLetIn na T1 T2 T3) =
it_mkProd_or_LetIn ctx' (tSort s)
| None => True
end
now destruct destArity.
Qed .
Lemma destArity_it_mkProd_or_LetIn ctx ctx' t :
destArity ctx (it_mkProd_or_LetIn ctx' t) =
destArity (ctx ,,, ctx') t.ctx : list context_decl
ctx' : context
t : term
destArity ctx (it_mkProd_or_LetIn ctx' t) =
destArity (ctx,,, ctx') t
Proof .ctx : list context_decl
ctx' : context
t : term
destArity ctx (it_mkProd_or_LetIn ctx' t) =
destArity (ctx,,, ctx') t
induction ctx' in ctx, t |- *; simpl ; auto .ctx : list context_decl
a : context_decl
ctx' : list context_decl
t : term
IHctx' : forall (ctx0 : list context_decl) (t0 : term),
destArity ctx0 (it_mkProd_or_LetIn ctx' t0) =
destArity (ctx0,,, ctx') t0
destArity ctx
(it_mkProd_or_LetIn ctx' (mkProd_or_LetIn a t)) =
destArity (a :: ctx,,, ctx') t
rewrite IHctx'.ctx : list context_decl
a : context_decl
ctx' : list context_decl
t : term
IHctx' : forall (ctx0 : list context_decl) (t0 : term),
destArity ctx0 (it_mkProd_or_LetIn ctx' t0) =
destArity (ctx0,,, ctx') t0
destArity (ctx,,, ctx') (mkProd_or_LetIn a t) =
destArity (a :: ctx,,, ctx') t
destruct a as [na [b|] ty]; reflexivity .
Qed .
Lemma it_mkProd_or_LetIn_inj ctx s ctx' s' :
it_mkProd_or_LetIn ctx (tSort s) = it_mkProd_or_LetIn ctx' (tSort s') ->
ctx = ctx' /\ s = s'.ctx : context
s : Universe .t
ctx' : context
s' : Universe .t
it_mkProd_or_LetIn ctx (tSort s) =
it_mkProd_or_LetIn ctx' (tSort s') ->
ctx = ctx' /\ s = s'
Proof .ctx : context
s : Universe .t
ctx' : context
s' : Universe .t
it_mkProd_or_LetIn ctx (tSort s) =
it_mkProd_or_LetIn ctx' (tSort s') ->
ctx = ctx' /\ s = s'
move /(f_equal (destArity [])).ctx : context
s : Universe .t
ctx' : context
s' : Universe .t
destArity [] (it_mkProd_or_LetIn ctx (tSort s)) =
destArity [] (it_mkProd_or_LetIn ctx' (tSort s')) ->
ctx = ctx' /\ s = s'
rewrite !destArity_it_mkProd_or_LetIn /=.ctx : context
s : Universe .t
ctx' : context
s' : Universe .t
Some ([],,, ctx, s) = Some ([],,, ctx', s') ->
ctx = ctx' /\ s = s'
now rewrite !app_context_nil_l => [= -> ->].
Qed .
(*
Lemma case_predicate_contextP ind mdecl idecl params uinst pctx :
build_case_predicate_context ind mdecl idecl params uinst = Some pctx <~>
case_predicate_context ind mdecl idecl params uinst pctx.
Proof.
unfold build_case_predicate_context.
unfold instantiate_params.
destruct instantiate_params_subst as [[ictx p]|] eqn:ipars => /= //.
2:{ split => //. intros H. depelim H.
eapply instantiate_params_substP in i.
rewrite ipars in i. discriminate. }
move: (destArity_spec [] (subst0 ictx p)).
destruct destArity as [[idctx inds]|] eqn:da => //.
simpl. intros eqs.
split.
eapply instantiate_params_substP in ipars.
intros [= <-]. econstructor. eauto. eauto.
intros H. depelim H. subst sty.
eapply instantiate_params_substP in i.
rewrite ipars in i. noconf i. rewrite eqs in e.
eapply it_mkProd_or_LetIn_inj in e as [<- <-].
reflexivity.
split => // [] [] s ty ictxt inds.
move/instantiate_params_substP.
rewrite ipars /= => [=] <- <- H.
rewrite H destArity_it_mkProd_or_LetIn in da.
noconf da.
Qed.
*)
Lemma wf_reln n acc Γ : Forall Ast.wf acc -> Forall Ast.wf (reln acc n Γ).n : nat
acc : list term
Γ : list context_decl
Forall Ast.wf acc -> Forall Ast.wf (reln acc n Γ)
Proof .n : nat
acc : list term
Γ : list context_decl
Forall Ast.wf acc -> Forall Ast.wf (reln acc n Γ)
induction Γ in acc, n |- * => wfacc /= //.n : nat
acc : list term
a : context_decl
Γ : list context_decl
IHΓ : forall (n0 : nat) (acc0 : list term),
Forall Ast.wf acc0 -> Forall Ast.wf (reln acc0 n0 Γ)
wfacc : Forall Ast.wf acc
Forall Ast.wf
match a with
| {| decl_body := Some _ |} => reln acc (n + 1 ) Γ
| {| decl_body := None |} =>
reln (tRel n :: acc) (n + 1 ) Γ
end
destruct a as [? [|] ?] => //.n : nat
acc : list term
decl_name : aname
t, decl_type : term
Γ : list context_decl
IHΓ : forall (n0 : nat) (acc0 : list term),
Forall Ast.wf acc0 ->
Forall Ast.wf (reln acc0 n0 Γ)
wfacc : Forall Ast.wf acc
Forall Ast.wf (reln acc (n + 1 ) Γ)
now eapply IHΓ.n : nat
acc : list term
decl_name : aname
decl_type : term
Γ : list context_decl
IHΓ : forall (n0 : nat) (acc0 : list term),
Forall Ast.wf acc0 ->
Forall Ast.wf (reln acc0 n0 Γ)
wfacc : Forall Ast.wf acc
Forall Ast.wf (reln (tRel n :: acc) (n + 1 ) Γ)
eapply IHΓ.n : nat
acc : list term
decl_name : aname
decl_type : term
Γ : list context_decl
IHΓ : forall (n0 : nat) (acc0 : list term),
Forall Ast.wf acc0 ->
Forall Ast.wf (reln acc0 n0 Γ)
wfacc : Forall Ast.wf acc
Forall Ast.wf (tRel n :: acc)
constructor ; auto .n : nat
acc : list term
decl_name : aname
decl_type : term
Γ : list context_decl
IHΓ : forall (n0 : nat) (acc0 : list term),
Forall Ast.wf acc0 ->
Forall Ast.wf (reln acc0 n0 Γ)
wfacc : Forall Ast.wf acc
Ast.wf (tRel n)
constructor .
Qed .
Hint Resolve wf_reln : wf .
Lemma wf_instantiate_params_subst_spec params pars s ty s' ty' :
instantiate_params_subst_spec params pars s ty s' ty' ->
Forall wf_decl params ->
Ast.wf ty ->
Forall Ast.wf pars ->
Forall Ast.wf s ->
Forall Ast.wf s' /\ Ast.wf ty'.params : context
pars, s : list term
ty : term
s' : list term
ty' : term
instantiate_params_subst_spec params pars s ty s' ty' ->
Forall wf_decl params ->
Ast.wf ty ->
Forall Ast.wf pars ->
Forall Ast.wf s -> Forall Ast.wf s' /\ Ast.wf ty'
Proof .params : context
pars, s : list term
ty : term
s' : list term
ty' : term
instantiate_params_subst_spec params pars s ty s' ty' ->
Forall wf_decl params ->
Ast.wf ty ->
Forall Ast.wf pars ->
Forall Ast.wf s -> Forall Ast.wf s' /\ Ast.wf ty'
intros ipars.params : context
pars, s : list term
ty : term
s' : list term
ty' : term
ipars : instantiate_params_subst_spec params pars s ty
s' ty'
Forall wf_decl params ->
Ast.wf ty ->
Forall Ast.wf pars ->
Forall Ast.wf s -> Forall Ast.wf s' /\ Ast.wf ty'
induction ipars; intros wfparams wfty wfpars wfs => //.na : aname
ty : term
params : context
pari : term
pars, s : list term
na' : aname
ty', pty : term
s' : list term
pty' : term
ipars : instantiate_params_subst_spec params pars
(pari :: s) pty s' pty'
IHipars : Forall wf_decl params ->
Ast.wf pty ->
Forall Ast.wf pars ->
Forall Ast.wf (pari :: s) ->
Forall Ast.wf s' /\ Ast.wf pty'
wfparams : Forall wf_decl (vass na ty :: params)
wfty : Ast.wf (tProd na' ty' pty)
wfpars : Forall Ast.wf (pari :: pars)
wfs : Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
depelim wfparams. na : aname
ty : term
params : context
pari : term
pars, s : list term
na' : aname
ty', pty : term
s' : list term
pty' : term
ipars : instantiate_params_subst_spec params pars
(pari :: s) pty s' pty'
IHipars : Forall wf_decl params ->
Ast.wf pty ->
Forall Ast.wf pars ->
Forall Ast.wf (pari :: s) ->
Forall Ast.wf s' /\ Ast.wf pty'
H : wf_decl (vass na ty)
wfparams : Forall wf_decl params
wfty : Ast.wf (tProd na' ty' pty)
wfpars : Forall Ast.wf (pari :: pars)
wfs : Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
depelim wfpars. na : aname
ty : term
params : context
pari : term
pars, s : list term
na' : aname
ty', pty : term
s' : list term
pty' : term
ipars : instantiate_params_subst_spec params pars
(pari :: s) pty s' pty'
IHipars : Forall wf_decl params ->
Ast.wf pty ->
Forall Ast.wf pars ->
Forall Ast.wf (pari :: s) ->
Forall Ast.wf s' /\ Ast.wf pty'
H : wf_decl (vass na ty)
wfparams : Forall wf_decl params
wfty : Ast.wf (tProd na' ty' pty)
H0 : Ast.wf pari
wfpars : Forall Ast.wf pars
wfs : Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
depelim wfty. na : aname
ty : term
params : context
pari : term
pars, s : list term
na' : aname
ty', pty : term
s' : list term
pty' : term
ipars : instantiate_params_subst_spec params pars
(pari :: s) pty s' pty'
IHipars : Forall wf_decl params ->
Ast.wf pty ->
Forall Ast.wf pars ->
Forall Ast.wf (pari :: s) ->
Forall Ast.wf s' /\ Ast.wf pty'
H : wf_decl (vass na ty)
wfparams : Forall wf_decl params
wfty1 : Ast.wf ty'
wfty2 : Ast.wf pty
H0 : Ast.wf pari
wfpars : Forall Ast.wf pars
wfs : Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
apply IHipars; auto .na : aname
b, ty : term
params : context
pars, s : list term
na' : aname
b', ty', pty : term
s' : list term
pty' : term
ipars : instantiate_params_subst_spec params pars
(subst0 s b :: s) pty s' pty'
IHipars : Forall wf_decl params ->
Ast.wf pty ->
Forall Ast.wf pars ->
Forall Ast.wf (subst0 s b :: s) ->
Forall Ast.wf s' /\ Ast.wf pty'
wfparams : Forall wf_decl (vdef na b ty :: params)
wfty : Ast.wf (tLetIn na' b' ty' pty)
wfpars : Forall Ast.wf pars
wfs : Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
depelim wfparams. na : aname
b, ty : term
params : context
pars, s : list term
na' : aname
b', ty', pty : term
s' : list term
pty' : term
ipars : instantiate_params_subst_spec params pars
(subst0 s b :: s) pty s' pty'
IHipars : Forall wf_decl params ->
Ast.wf pty ->
Forall Ast.wf pars ->
Forall Ast.wf (subst0 s b :: s) ->
Forall Ast.wf s' /\ Ast.wf pty'
H : wf_decl (vdef na b ty)
wfparams : Forall wf_decl params
wfty : Ast.wf (tLetIn na' b' ty' pty)
wfpars : Forall Ast.wf pars
wfs : Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
depelim wfty. na : aname
b, ty : term
params : context
pars, s : list term
na' : aname
b', ty', pty : term
s' : list term
pty' : term
ipars : instantiate_params_subst_spec params pars
(subst0 s b :: s) pty s' pty'
IHipars : Forall wf_decl params ->
Ast.wf pty ->
Forall Ast.wf pars ->
Forall Ast.wf (subst0 s b :: s) ->
Forall Ast.wf s' /\ Ast.wf pty'
H : wf_decl (vdef na b ty)
wfparams : Forall wf_decl params
wfty1 : Ast.wf b'
wfty2 : Ast.wf ty'
wfty3 : Ast.wf pty
wfpars : Forall Ast.wf pars
wfs : Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
destruct H; simpl in *.na : aname
b, ty : term
params : context
pars, s : list term
na' : aname
b', ty', pty : term
s' : list term
pty' : term
ipars : instantiate_params_subst_spec params pars
(subst0 s b :: s) pty s' pty'
IHipars : Forall wf_decl params ->
Ast.wf pty ->
Forall Ast.wf pars ->
Forall Ast.wf (subst0 s b :: s) ->
Forall Ast.wf s' /\ Ast.wf pty'
H : Ast.wf b
H0 : Ast.wf ty
wfparams : Forall wf_decl params
wfty1 : Ast.wf b'
wfty2 : Ast.wf ty'
wfty3 : Ast.wf pty
wfpars : Forall Ast.wf pars
wfs : Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
apply IHipars; auto with wf .
Qed .
Lemma wf_map2_set_binder_name l l' :
Forall wf_decl l' ->
Forall wf_decl (map2 set_binder_name l l').l : list aname
l' : list context_decl
Forall wf_decl l' ->
Forall wf_decl (map2 set_binder_name l l')
Proof .l : list aname
l' : list context_decl
Forall wf_decl l' ->
Forall wf_decl (map2 set_binder_name l l')
induction 1 in l |- *; destruct l; simpl ; constructor .a : aname
l : list aname
x : context_decl
l0 : list context_decl
H : wf_decl x
H0 : Forall wf_decl l0
IHForall : forall l1 : list aname,
Forall wf_decl (map2 set_binder_name l1 l0)
wf_decl (set_binder_name a x)
apply H.a : aname
l : list aname
x : context_decl
l0 : list context_decl
H : wf_decl x
H0 : Forall wf_decl l0
IHForall : forall l1 : list aname,
Forall wf_decl (map2 set_binder_name l1 l0)
Forall wf_decl (map2 set_binder_name l l0)
apply IHForall.
Qed .
Definition lift_context_snoc0 n k Γ d : lift_context n k (d :: Γ) = lift_context n k Γ ,, lift_decl n (#|Γ| + k) d.n, k : nat
Γ : list context_decl
d : context_decl
lift_context n k (d :: Γ) =
lift_context n k Γ,, lift_decl n (#|Γ| + k) d
Proof .n, k : nat
Γ : list context_decl
d : context_decl
lift_context n k (d :: Γ) =
lift_context n k Γ,, lift_decl n (#|Γ| + k) d
unfold lift_context.n, k : nat
Γ : list context_decl
d : context_decl
fold_context_k (shiftf (lift n) k) (d :: Γ) =
fold_context_k (shiftf (lift n) k) Γ,,
lift_decl n (#|Γ| + k) d
now rewrite fold_context_k_snoc0. Qed .
Hint Rewrite lift_context_snoc0 : lift.
Lemma lift_context_snoc n k Γ d : lift_context n k (Γ ,, d) = lift_context n k Γ ,, lift_decl n (#|Γ| + k) d.n, k : nat
Γ : list context_decl
d : context_decl
lift_context n k (Γ,, d) =
lift_context n k Γ,, lift_decl n (#|Γ| + k) d
Proof .n, k : nat
Γ : list context_decl
d : context_decl
lift_context n k (Γ,, d) =
lift_context n k Γ,, lift_decl n (#|Γ| + k) d
unfold snoc.n, k : nat
Γ : list context_decl
d : context_decl
lift_context n k (d :: Γ) =
lift_decl n (#|Γ| + k) d :: lift_context n k Γ
apply lift_context_snoc0.
Qed .
Hint Rewrite lift_context_snoc : lift.
Lemma wf_subst_context s k Γ : Forall wf_decl Γ -> Forall Ast.wf s -> Forall wf_decl (subst_context s k Γ).s : list term
k : nat
Γ : list context_decl
Forall wf_decl Γ ->
Forall Ast.wf s ->
Forall wf_decl (subst_context s k Γ)
Proof .s : list term
k : nat
Γ : list context_decl
Forall wf_decl Γ ->
Forall Ast.wf s ->
Forall wf_decl (subst_context s k Γ)
intros wfΓ.s : list term
k : nat
Γ : list context_decl
wfΓ : Forall wf_decl Γ
Forall Ast.wf s ->
Forall wf_decl (subst_context s k Γ)
induction wfΓ in s |- *.Forall Ast.wf s ->
Forall wf_decl (subst_context s k [])
- Forall Ast.wf s ->
Forall wf_decl (subst_context s k [])
intros .s : list term
k : nat
H : Forall Ast.wf s
Forall wf_decl (subst_context s k [])
constructor .
- s : list term
k : nat
x : context_decl
l : list context_decl
H : wf_decl x
wfΓ : Forall wf_decl l
IHwfΓ : forall s0 : list term,
Forall Ast.wf s0 ->
Forall wf_decl (subst_context s0 k l)
Forall Ast.wf s ->
Forall wf_decl (subst_context s k (x :: l))
rewrite subst_context_snoc.s : list term
k : nat
x : context_decl
l : list context_decl
H : wf_decl x
wfΓ : Forall wf_decl l
IHwfΓ : forall s0 : list term,
Forall Ast.wf s0 ->
Forall wf_decl (subst_context s0 k l)
Forall Ast.wf s ->
Forall wf_decl
(subst_context s k l,, subst_decl s (#|l| + k) x)
constructor ; auto .s : list term
k : nat
x : context_decl
l : list context_decl
H : wf_decl x
wfΓ : Forall wf_decl l
IHwfΓ : forall s0 : list term,
Forall Ast.wf s0 ->
Forall wf_decl (subst_context s0 k l)
H0 : Forall Ast.wf s
wf_decl (subst_decl s (#|l| + k) x)
destruct H.s : list term
k : nat
x : context_decl
l : list context_decl
H : match decl_body x with
| Some b => Ast.wf b
| None => True
end
H1 : Ast.wf (decl_type x)
wfΓ : Forall wf_decl l
IHwfΓ : forall s0 : list term,
Forall Ast.wf s0 ->
Forall wf_decl (subst_context s0 k l)
H0 : Forall Ast.wf s
wf_decl (subst_decl s (#|l| + k) x)
destruct x as [? [] ?]; constructor ; simpl in *; wf .
Qed .
Lemma wf_lift_context n k Γ : Forall wf_decl Γ -> Forall wf_decl (lift_context n k Γ).n, k : nat
Γ : list context_decl
Forall wf_decl Γ ->
Forall wf_decl (lift_context n k Γ)
Proof .n, k : nat
Γ : list context_decl
Forall wf_decl Γ ->
Forall wf_decl (lift_context n k Γ)
intros wfΓ.n, k : nat
Γ : list context_decl
wfΓ : Forall wf_decl Γ
Forall wf_decl (lift_context n k Γ)
induction wfΓ in n, k |- *.Forall wf_decl (lift_context n k [])
- Forall wf_decl (lift_context n k [])
intros .Forall wf_decl (lift_context n k [])
constructor .
- n, k : nat
x : context_decl
l : list context_decl
H : wf_decl x
wfΓ : Forall wf_decl l
IHwfΓ : forall n0 k0 : nat,
Forall wf_decl (lift_context n0 k0 l)
Forall wf_decl (lift_context n k (x :: l))
rewrite lift_context_snoc0.n, k : nat
x : context_decl
l : list context_decl
H : wf_decl x
wfΓ : Forall wf_decl l
IHwfΓ : forall n0 k0 : nat,
Forall wf_decl (lift_context n0 k0 l)
Forall wf_decl
(lift_context n k l,, lift_decl n (#|l| + k) x)
constructor ; auto .n, k : nat
x : context_decl
l : list context_decl
H : wf_decl x
wfΓ : Forall wf_decl l
IHwfΓ : forall n0 k0 : nat,
Forall wf_decl (lift_context n0 k0 l)
wf_decl (lift_decl n (#|l| + k) x)
destruct H.n, k : nat
x : context_decl
l : list context_decl
H : match decl_body x with
| Some b => Ast.wf b
| None => True
end
H0 : Ast.wf (decl_type x)
wfΓ : Forall wf_decl l
IHwfΓ : forall n0 k0 : nat,
Forall wf_decl (lift_context n0 k0 l)
wf_decl (lift_decl n (#|l| + k) x)
destruct x as [? [] ?]; constructor ; simpl in *; wf .
Qed .
Lemma wf_subst_instance_context u Γ :
Forall wf_decl Γ ->
Forall wf_decl (subst_instance u Γ).u : Instance .t
Γ : list context_decl
Forall wf_decl Γ ->
Forall wf_decl (subst_instance u Γ)
Proof .u : Instance .t
Γ : list context_decl
Forall wf_decl Γ ->
Forall wf_decl (subst_instance u Γ)
induction 1 ; constructor ; auto .u : Instance .t
x : context_decl
l : list context_decl
H : wf_decl x
H0 : Forall wf_decl l
IHForall : Forall wf_decl (subst_instance u l)
wf_decl (map_decl (subst_instance u) x)
destruct x as [na [b|] ty]; simpl in *.u : Instance .t
na : aname
b, ty : term
l : list context_decl
H : wf_decl
{|
decl_name := na;
decl_body := Some b;
decl_type := ty |}
H0 : Forall wf_decl l
IHForall : Forall wf_decl (subst_instance u l)
wf_decl
(map_decl (subst_instance u)
{|
decl_name := na;
decl_body := Some b;
decl_type := ty |})
destruct H.u : Instance .t
na : aname
b, ty : term
l : list context_decl
H : match
decl_body
{|
decl_name := na;
decl_body := Some b;
decl_type := ty |}
with
| Some b0 => Ast.wf b0
| None => True
end
H1 : Ast.wf
(decl_type
{|
decl_name := na;
decl_body := Some b;
decl_type := ty |})
H0 : Forall wf_decl l
IHForall : Forall wf_decl (subst_instance u l)
wf_decl
(map_decl (subst_instance u)
{|
decl_name := na;
decl_body := Some b;
decl_type := ty |})
now split ; apply wf_subst_instance.u : Instance .t
na : aname
ty : term
l : list context_decl
H : wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
H0 : Forall wf_decl l
IHForall : Forall wf_decl (subst_instance u l)
wf_decl
(map_decl (subst_instance u)
{|
decl_name := na;
decl_body := None;
decl_type := ty |})
destruct H.u : Instance .t
na : aname
ty : term
l : list context_decl
H : match
decl_body
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
with
| Some b => Ast.wf b
| None => True
end
H1 : Ast.wf
(decl_type
{|
decl_name := na;
decl_body := None;
decl_type := ty |})
H0 : Forall wf_decl l
IHForall : Forall wf_decl (subst_instance u l)
wf_decl
(map_decl (subst_instance u)
{|
decl_name := na;
decl_body := None;
decl_type := ty |})
now split ; auto ; apply wf_subst_instance.
Qed .
Lemma wf_extended_subst Γ n :
Forall wf_decl Γ ->
Forall Ast.wf (extended_subst Γ n).Forall wf_decl Γ -> Forall Ast.wf (extended_subst Γ n)
Proof .Forall wf_decl Γ -> Forall Ast.wf (extended_subst Γ n)
induction 1 in n |- *.Forall Ast.wf (extended_subst [] n)
- Forall Ast.wf (extended_subst [] n)
simpl ; constructor .
- n : nat
x : context_decl
l : list context_decl
H : wf_decl x
H0 : Forall wf_decl l
IHForall : forall n0 : nat,
Forall Ast.wf (extended_subst l n0)
Forall Ast.wf (extended_subst (x :: l) n)
destruct x as [na [b|] ty]; simpl ; constructor ; auto .n : nat
na : aname
b, ty : term
l : list context_decl
H : wf_decl
{|
decl_name := na;
decl_body := Some b;
decl_type := ty |}
H0 : Forall wf_decl l
IHForall : forall n0 : nat,
Forall Ast.wf (extended_subst l n0)
Ast.wf
(subst0 (extended_subst l n)
(lift (context_assumptions l + n)
#|extended_subst l n| b))
2 :constructor .n : nat
na : aname
b, ty : term
l : list context_decl
H : wf_decl
{|
decl_name := na;
decl_body := Some b;
decl_type := ty |}
H0 : Forall wf_decl l
IHForall : forall n0 : nat,
Forall Ast.wf (extended_subst l n0)
Ast.wf
(subst0 (extended_subst l n)
(lift (context_assumptions l + n)
#|extended_subst l n| b))
eapply wf_subst; auto .n : nat
na : aname
b, ty : term
l : list context_decl
H : wf_decl
{|
decl_name := na;
decl_body := Some b;
decl_type := ty |}
H0 : Forall wf_decl l
IHForall : forall n0 : nat,
Forall Ast.wf (extended_subst l n0)
Ast.wf
(lift (context_assumptions l + n)
#|extended_subst l n| b)
eapply wf_lift.n : nat
na : aname
b, ty : term
l : list context_decl
H : wf_decl
{|
decl_name := na;
decl_body := Some b;
decl_type := ty |}
H0 : Forall wf_decl l
IHForall : forall n0 : nat,
Forall Ast.wf (extended_subst l n0)
Ast.wf b
apply H.
Qed .
Lemma wf_case_predicate_context ind mdecl idecl params uinst pctx :
Forall wf_decl mdecl.(ind_params) ->
Forall wf_decl (ind_indices idecl) ->
Forall Ast.wf params ->
Forall wf_decl (case_predicate_context ind mdecl idecl params uinst pctx).ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
Forall wf_decl (ind_params mdecl) ->
Forall wf_decl (ind_indices idecl) ->
Forall Ast.wf params ->
Forall wf_decl
(case_predicate_context ind mdecl idecl params uinst
pctx)
Proof .ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
Forall wf_decl (ind_params mdecl) ->
Forall wf_decl (ind_indices idecl) ->
Forall Ast.wf params ->
Forall wf_decl
(case_predicate_context ind mdecl idecl params uinst
pctx)
intros wfparams wfindty wfpars.ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall wf_decl
(case_predicate_context ind mdecl idecl params uinst
pctx)
unfold case_predicate_context.ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall wf_decl
(map2 set_binder_name pctx
({|
decl_name := {|
binder_name := nNamed
(ind_name idecl);
binder_relevance := ind_relevance
idecl |};
decl_body := None;
decl_type := mkApps
(tInd ind uinst)
(map
(lift0 #|ind_indices idecl|)
params ++
to_extended_list
(ind_indices idecl)) |}
:: subst_context params 0
(subst_instance uinst
(expand_lets_ctx
(ind_params mdecl)
(ind_indices idecl)))))
apply wf_map2_set_binder_name.ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall wf_decl
({|
decl_name := {|
binder_name := nNamed (ind_name idecl);
binder_relevance := ind_relevance
idecl |};
decl_body := None;
decl_type := mkApps (tInd ind uinst)
(map (lift0 #|ind_indices idecl|)
params ++
to_extended_list
(ind_indices idecl)) |}
:: subst_context params 0
(subst_instance uinst
(expand_lets_ctx
(ind_params mdecl)
(ind_indices idecl))))
constructor .ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
wf_decl
{|
decl_name := {|
binder_name := nNamed (ind_name idecl);
binder_relevance := ind_relevance idecl |};
decl_body := None;
decl_type := mkApps (tInd ind uinst)
(map (lift0 #|ind_indices idecl|)
params ++
to_extended_list (ind_indices idecl)) |}
simpl ; split ; auto .ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
match
decl_body
{|
decl_name := {|
binder_name := nNamed
(ind_name idecl);
binder_relevance := ind_relevance
idecl |};
decl_body := None;
decl_type := mkApps
(tInd ind uinst)
(map
(lift0 #|ind_indices idecl|)
params ++
to_extended_list
(ind_indices idecl)) |}
with
| Some b => Ast.wf b
| None => True
end
simpl .ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
True
auto .ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Ast.wf
(decl_type
{|
decl_name := {|
binder_name := nNamed
(ind_name idecl);
binder_relevance := ind_relevance
idecl |};
decl_body := None;
decl_type := mkApps
(tInd ind uinst)
(map
(lift0 #|ind_indices idecl|)
params ++
to_extended_list
(ind_indices idecl)) |})
simpl .ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Ast.wf
(mkApps (tInd ind uinst)
(map (lift0 #|ind_indices idecl|) params ++
to_extended_list (ind_indices idecl)))
eapply wf_mkApps.ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Ast.wf (tInd ind uinst)
constructor .ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall Ast.wf
(map (lift0 #|ind_indices idecl|) params ++
to_extended_list (ind_indices idecl))
apply app_Forall.ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall Ast.wf
(map (lift0 #|ind_indices idecl|) params)
solve_all; auto with wf . ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall Ast.wf (to_extended_list (ind_indices idecl))
now apply wf_reln.ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall wf_decl
(subst_context params 0
(subst_instance uinst
(expand_lets_ctx
(ind_params mdecl)
(ind_indices idecl))))
eapply wf_subst_context => //.ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall wf_decl
(subst_instance uinst
(expand_lets_ctx (ind_params mdecl)
(ind_indices idecl)))
apply wf_subst_instance_context, wf_subst_context.ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall wf_decl
(lift_context
(context_assumptions (ind_params mdecl))
(0 + #|ind_params mdecl|)
(ind_indices idecl))
now apply wf_lift_context.ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
params : list term
uinst : Instance .t
pctx : list aname
wfparams : Forall wf_decl (ind_params mdecl)
wfindty : Forall wf_decl (ind_indices idecl)
wfpars : Forall Ast.wf params
Forall Ast.wf (extended_subst (ind_params mdecl) 0 )
now apply wf_extended_subst.
Qed .
Lemma on_global_wf_Forall_decls {cf :checker_flags} Σ :
on_global_env
(fun _ : Env.global_env_ext => wf_decl_pred) Σ ->
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.cf : checker_flags
Σ : global_env
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ
Proof .cf : checker_flags
Σ : global_env
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ
apply on_global_env_impl => Σ' Γ t []; simpl ; unfold wf_decl_pred;
intros ; auto .cf : checker_flags
Σ : global_env
Σ' : global_env * universes_decl
Γ : context
t : term
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T : option term) =>
Ast.wf t0 /\
match T with
| Some T0 => Ast.wf T0
| None => True
end ) Σ'.1
H : Ast.wf t /\ True
∑ s : Universe .t, Ast.wf t /\ Ast.wf (tSort s)
exists (Universe .lProp).cf : checker_flags
Σ : global_env
Σ' : global_env * universes_decl
Γ : context
t : term
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T : option term) =>
Ast.wf t0 /\
match T with
| Some T0 => Ast.wf T0
| None => True
end ) Σ'.1
H : Ast.wf t /\ True
Ast.wf t /\ Ast.wf (tSort Universe .lProp)
wf .
Qed .
Lemma Forall_decls_on_global_wf {cf :checker_flags} Σ :
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ ->
on_global_env (fun _ : Env.global_env_ext => wf_decl_pred) Σ.cf : checker_flags
Σ : global_env
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ
Proof .cf : checker_flags
Σ : global_env
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ
apply on_global_env_impl => Σ' Γ t []; simpl ; unfold wf_decl_pred;
intros ; auto .cf : checker_flags
Σ : global_env
Σ' : global_env * universes_decl
Γ : context
t : term
X : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext) (_ : context )
(t0 T : term) => Ast.wf t0 /\ Ast.wf T))
Σ'.1
X0 : ∑ s : Universe .t, Ast.wf t /\ Ast.wf (tSort s)
Ast.wf t /\ True
destruct X0 as [s ?]; intuition auto .
Qed .
Hint Resolve on_global_wf_Forall_decls : wf .
Lemma wf_case_branches_context {cf :checker_flags} Σ ind mdecl idecl p :
on_global_env (fun Σ => wf_decl_pred) Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall Ast.wf (pparams p) ->
Forall (fun ctor => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) ->
Forall (fun ctx => Forall wf_decl ctx) (case_branches_contexts idecl p).cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall Ast.wf (pparams p) ->
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) ->
Forall
(fun ctx : list context_decl => Forall wf_decl ctx)
(case_branches_contexts idecl p)
Proof .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
declared_inductive Σ ind mdecl idecl ->
Forall Ast.wf (pparams p) ->
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall
(fun ctx : list context_decl => Forall wf_decl ctx)
(case_branches_contexts idecl p)
intros ong decli wfpars.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_inductive Σ ind mdecl idecl
wfpars : Forall Ast.wf (pparams p)
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall
(fun ctx : list context_decl => Forall wf_decl ctx)
(case_branches_contexts idecl p)
unfold case_branches_contexts.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_inductive Σ ind mdecl idecl
wfpars : Forall Ast.wf (pparams p)
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall
(fun ctx : list context_decl => Forall wf_decl ctx)
(map
(case_branch_context_gen (pparams p) (puinst p))
(ind_ctors idecl))
intros Hforall.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_inductive Σ ind mdecl idecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
Forall
(fun ctx : list context_decl => Forall wf_decl ctx)
(map
(case_branch_context_gen (pparams p) (puinst p))
(ind_ctors idecl))
eapply Forall_map.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_inductive Σ ind mdecl idecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
Forall
(fun x : constructor_body =>
Forall wf_decl
(case_branch_context_gen (pparams p) (puinst p) x))
(ind_ctors idecl)
eapply Forall_impl; eauto .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_inductive Σ ind mdecl idecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
forall x : constructor_body,
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor)) x ->
Forall wf_decl
(case_branch_context_gen (pparams p) (puinst p) x)
intros .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_inductive Σ ind mdecl idecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
x : constructor_body
H : (fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor)) x
Forall wf_decl
(case_branch_context_gen (pparams p) (puinst p) x)
simpl in H.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_inductive Σ ind mdecl idecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
x : constructor_body
H : Forall wf_decl (cstr_args x)
Forall wf_decl
(case_branch_context_gen (pparams p) (puinst p) x)
unfold case_branch_context_gen.cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_inductive Σ ind mdecl idecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
x : constructor_body
H : Forall wf_decl (cstr_args x)
Forall wf_decl
(subst_context (pparams p) 0
(subst_instance (puinst p) (cstr_args x)))
apply wf_subst_context; auto .cf : checker_flags
Σ : global_env
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_inductive Σ ind mdecl idecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
x : constructor_body
H : Forall wf_decl (cstr_args x)
Forall wf_decl
(subst_instance (puinst p) (cstr_args x))
now apply wf_subst_instance_context.
Qed .
Lemma wf_case_branch_context {cf :checker_flags} Σ ind mdecl idecl cdecl p :
on_global_env (fun Σ => wf_decl_pred) Σ ->
declared_constructor Σ ind mdecl idecl cdecl ->
Forall Ast.wf (pparams p) ->
Forall (fun ctor => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) ->
Forall wf_decl (case_branch_context p cdecl).cf : checker_flags
Σ : global_env
ind : inductive * nat
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
p : predicate term
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
declared_constructor Σ ind mdecl idecl cdecl ->
Forall Ast.wf (pparams p) ->
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) ->
Forall wf_decl (case_branch_context p cdecl)
Proof .cf : checker_flags
Σ : global_env
ind : inductive * nat
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
p : predicate term
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
declared_constructor Σ ind mdecl idecl cdecl ->
Forall Ast.wf (pparams p) ->
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall wf_decl (case_branch_context p cdecl)
intros ong decli wfpars.cf : checker_flags
Σ : global_env
ind : inductive * nat
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_constructor Σ ind mdecl idecl cdecl
wfpars : Forall Ast.wf (pparams p)
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall wf_decl (case_branch_context p cdecl)
unfold case_branch_context.cf : checker_flags
Σ : global_env
ind : inductive * nat
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_constructor Σ ind mdecl idecl cdecl
wfpars : Forall Ast.wf (pparams p)
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall wf_decl
(case_branch_context_gen
(pparams p) (puinst p) cdecl)
intros Hforall.cf : checker_flags
Σ : global_env
ind : inductive * nat
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_constructor Σ ind mdecl idecl cdecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
Forall wf_decl
(case_branch_context_gen
(pparams p) (puinst p) cdecl)
unfold case_branch_context_gen.cf : checker_flags
Σ : global_env
ind : inductive * nat
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_constructor Σ ind mdecl idecl cdecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
Forall wf_decl
(subst_context (pparams p) 0
(subst_instance (puinst p) (cstr_args cdecl)))
apply wf_subst_context; auto .cf : checker_flags
Σ : global_env
ind : inductive * nat
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_constructor Σ ind mdecl idecl cdecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
Forall wf_decl
(subst_instance (puinst p) (cstr_args cdecl))
apply wf_subst_instance_context.cf : checker_flags
Σ : global_env
ind : inductive * nat
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
decli : declared_constructor Σ ind mdecl idecl cdecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
Forall wf_decl (cstr_args cdecl)
destruct decli.cf : checker_flags
Σ : global_env
ind : inductive * nat
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
p : predicate term
ong : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
H : declared_inductive Σ ind.1 mdecl idecl
H0 : nth_error (ind_ctors idecl) ind.2 = Some cdecl
wfpars : Forall Ast.wf (pparams p)
Hforall : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
Forall wf_decl (cstr_args cdecl)
now eapply nth_error_forall in Hforall; tea.
Qed .
Lemma declared_inductive_wf_ctors' {cf :checker_flags} {Σ : global_env_ext} {ind mdecl idecl } :
forall (oib : on_ind_body (lift_typing (fun _ _ (t T : term) => Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl (inductive_ind ind) idecl),
Forall (fun cs => Forall wf_decl (cstr_args cs)) idecl.(ind_ctors).cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
on_ind_body
(lift_typing
(fun (_ : global_env_ext) (_ : context )
(t T : term) => Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl (inductive_ind ind) idecl ->
Forall
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs)) (ind_ctors idecl)
Proof .cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
on_ind_body
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl
(inductive_ind ind) idecl ->
Forall
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs))
(ind_ctors idecl)
intros oib.cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
oib : on_ind_body
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
Forall
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs))
(ind_ctors idecl)
pose proof (onConstructors oib) as h.cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
oib : on_ind_body
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
h : on_constructors
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ mdecl
(inductive_ind ind) idecl
(ind_indices idecl) (ind_ctors idecl)
(ind_cunivs oib)
Forall
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs))
(ind_ctors idecl)
unfold on_constructors in h.cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
oib : on_ind_body
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
h : All2
(on_constructor
(lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ mdecl
(inductive_ind ind) idecl
(ind_indices idecl))
(ind_ctors idecl) (ind_cunivs oib)
Forall
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs))
(ind_ctors idecl)
induction h; constructor ; auto .cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
oib : on_ind_body
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
x : constructor_body
y : list Universe .t
l : list constructor_body
l' : list (list Universe .t)
r : on_constructor
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ mdecl
(inductive_ind ind) idecl
(ind_indices idecl) x y
h : All2
(on_constructor
(lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ mdecl
(inductive_ind ind) idecl
(ind_indices idecl)) l l'
IHh : Forall
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs)) l
Forall wf_decl (cstr_args x)
destruct r.cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
oib : on_ind_body
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl
(inductive_ind ind) idecl
x : constructor_body
y : list Universe .t
l : list constructor_body
l' : list (list Universe .t)
cstr_args_length : context_assumptions (cstr_args x) =
cstr_arity x
cstr_eq : cstr_type x =
it_mkProd_or_LetIn (ind_params mdecl)
(it_mkProd_or_LetIn (cstr_args x)
(cstr_concl mdecl (inductive_ind ind)
idecl x))
on_ctype : on_type
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(arities_context (ind_bodies mdecl))
(cstr_type x)
on_cargs : sorts_local_ctx
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) (cstr_args x) y
on_cindices : TemplateEnvTyping.ctx_inst
(fun (Σ0 : global_env_ext)
(Γ : context ) (t T : term) =>
lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t0 T0 : term) =>
Ast.wf t0 /\ Ast.wf T0) Σ0 Γ t
(Some T)) Σ
(arities_context (ind_bodies mdecl),,,
ind_params mdecl,,, cstr_args x)
(cstr_indices x)
(List.rev
(lift_context #|cstr_args x| 0
(ind_indices idecl)))
on_ctype_positive : positive_cstr mdecl
(inductive_ind ind) []
(cstr_type x)
on_ctype_variance : forall v : list Variance.t,
ind_variance mdecl = Some v ->
cstr_respects_variance Σ mdecl v x
h : All2
(on_constructor
(lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ mdecl
(inductive_ind ind) idecl
(ind_indices idecl)) l l'
IHh : Forall
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs)) l
Forall wf_decl (cstr_args x)
clear -on_cargs.Σ : global_env_ext
mdecl : mutual_inductive_body
x : constructor_body
y : list Universe .t
on_cargs : sorts_local_ctx
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) (cstr_args x) y
Forall wf_decl (cstr_args x)
revert on_cargs.Σ : global_env_ext
mdecl : mutual_inductive_body
x : constructor_body
y : list Universe .t
sorts_local_ctx
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) (cstr_args x) y ->
Forall wf_decl (cstr_args x)
revert y.Σ : global_env_ext
mdecl : mutual_inductive_body
x : constructor_body
forall y : list Universe .t,
sorts_local_ctx
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) (cstr_args x) y ->
Forall wf_decl (cstr_args x)
generalize (cstr_args x).Σ : global_env_ext
mdecl : mutual_inductive_body
x : constructor_body
forall (c : context ) (y : list Universe.t),
sorts_local_ctx
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(arities_context (ind_bodies mdecl),,,
ind_params mdecl) c y ->
Forall wf_decl c
induction c as [|[? [] ?] ?]; simpl ;
destruct y; intuition auto ;
constructor ;
try red ; simpl ; intuition eauto .
Qed .
Lemma wf_red1 {cf :checker_flags} Σ Γ M N :
on_global_env (fun Σ => wf_decl_pred) Σ ->
List.Forall wf_decl Γ ->
Ast.wf M ->
red1 Σ Γ M N ->
Ast.wf N.cf : checker_flags
Σ : global_env
Γ : list context_decl
M, N : term
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
Forall wf_decl Γ ->
Ast.wf M -> red1 Σ Γ M N -> Ast.wf N
Proof .cf : checker_flags
Σ : global_env
Γ : list context_decl
M, N : term
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ ->
Forall wf_decl Γ ->
Ast.wf M -> red1 Σ Γ M N -> Ast.wf N
intros wfΣ wfΓ wfM H.cf : checker_flags
Σ : global_env
Γ : list context_decl
M, N : term
wfΣ : on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
wfΓ : Forall wf_decl Γ
wfM : Ast.wf M
H : red1 Σ Γ M N
Ast.wf N
induction H using red1_ind_all in wfM, wfΓ |- *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
na : aname
t, b, a : term
l : list term
wfM : Ast.wf (tApp (tLambda na t b) (a :: l))
Ast.wf (mkApps (b {0 := a}) l)
all : inv wfM.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
na : aname
t, b, a : term
l : list term
H : isApp (tLambda na t b) = false
H0 : a :: l <> []
H1 : Ast.wf (tLambda na t b)
H2 : Forall Ast.wf (a :: l)
Ast.wf (mkApps (b {0 := a}) l)
all : try solve [ constructor ; intuition auto with wf ].cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
na : aname
t, b, a : term
l : list term
H : isApp (tLambda na t b) = false
H0 : a :: l <> []
H1 : Ast.wf (tLambda na t b)
H2 : Forall Ast.wf (a :: l)
Ast.wf (mkApps (b {0 := a}) l)
all :auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
na : aname
t, b, a : term
l : list term
H : isApp (tLambda na t b) = false
H0 : a :: l <> []
H1 : Ast.wf (tLambda na t b)
H2 : Forall Ast.wf (a :: l)
Ast.wf (mkApps (b {0 := a}) l)
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
na : aname
t, b, a : term
l : list term
H : isApp (tLambda na t b) = false
H0 : a :: l <> []
H1 : Ast.wf (tLambda na t b)
H2 : Forall Ast.wf (a :: l)
Ast.wf (mkApps (b {0 := a}) l)
inv H1. cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
na : aname
t, b, a : term
l : list term
H : isApp (tLambda na t b) = false
H0 : a :: l <> []
H2 : Forall Ast.wf (a :: l)
H3 : Ast.wf t
H4 : Ast.wf b
Ast.wf (mkApps (b {0 := a}) l)
inv H2. cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
na : aname
t, b, a : term
l : list term
H : isApp (tLambda na t b) = false
H0 : a :: l <> []
H3 : Ast.wf t
H4 : Ast.wf b
H1 : Ast.wf a
H5 : Forall Ast.wf l
Ast.wf (mkApps (b {0 := a}) l)
eauto with wf .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
na : aname
b, t, b' : term
H : Ast.wf b
H0 : Ast.wf t
H1 : Ast.wf b'
Ast.wf (b' {0 := b})
auto with wf .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
i : nat
body : term
H : option_map decl_body (nth_error Γ i) =
Some (Some body)
Ast.wf (lift0 (S i) body)
apply wf_lift.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
i : nat
body : term
H : option_map decl_body (nth_error Γ i) =
Some (Some body)
Ast.wf body
unfold option_map in H.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
i : nat
body : term
H : match nth_error Γ i with
| Some a => Some (decl_body a)
| None => None
end = Some (Some body)
Ast.wf body
destruct nth_error eqn :Heq; try discriminate .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
i : nat
body : term
c : context_decl
Heq : nth_error Γ i = Some c
H : Some (decl_body c) = Some (Some body)
Ast.wf body
eapply nth_error_forall in wfΓ; eauto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
i : nat
body : term
c : context_decl
Heq : nth_error Γ i = Some c
H : Some (decl_body c) = Some (Some body)
wfΓ : wf_decl c
Ast.wf body
unfold wf_decl in *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
i : nat
body : term
c : context_decl
Heq : nth_error Γ i = Some c
H : Some (decl_body c) = Some (Some body)
wfΓ : match decl_body c with
| Some b => Ast.wf b
| None => True
end /\ Ast.wf (decl_type c)
Ast.wf body
apply some_inj in H; rewrite H in wfΓ; apply wfΓ.
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Ast.wf (mkApps (tConstruct (ci_ind ci) c u) args)
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf (iota_red (ci_npar ci) args bctx br)
unfold iota_red.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Ast.wf (mkApps (tConstruct (ci_ind ci) c u) args)
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf
(subst0 (List.rev (skipn (ci_npar ci) args))
(expand_lets bctx (bbody br)))
eapply wf_mkApps_inv in H4.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf
(subst0 (List.rev (skipn (ci_npar ci) args))
(expand_lets bctx (bbody br)))
apply wf_subst.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall Ast.wf (List.rev (skipn (ci_npar ci) args))
eapply rev_Forall.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall Ast.wf (skipn (ci_npar ci) args)
now eapply Forall_skipn.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf (expand_lets bctx (bbody br))
rewrite /expand_lets /expand_lets_k.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf
(subst0 (extended_subst bctx 0 )
(lift (context_assumptions bctx)
(0 + #|bctx|) (bbody br)))
apply wf_subst.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall Ast.wf (extended_subst bctx 0 )
apply wf_extended_subst.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall wf_decl bctx
rewrite /bctx.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall wf_decl (case_branch_context p cdecl)
eapply wf_case_branch_context; tea.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
eapply declared_inductive_wf_ctors.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T)
?Σ
now eapply on_global_wf_Forall_decls in wfΣ.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
declared_inductive Σ ?ind ?mdecl idecl
apply H0.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf
(lift (context_assumptions bctx)
(0 + #|bctx|) (bbody br))
eapply wf_lift.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
c : nat
u : Instance .t
args : list term
p : predicate term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
br : branch term
H : nth_error brs c = Some br
H0 : declared_constructor Σ (ci_ind ci, c) mdecl idecl
cdecl
bctx := case_branch_context p cdecl : context
H1 : #|skipn (ci_npar ci) args| =
context_assumptions bctx
H2 : Forall Ast.wf (pparams p)
H3 : Ast.wf (preturn p)
H4 : Forall Ast.wf args
H5 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf (bbody br)
now eapply nth_error_forall in H5; tea.
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix : mfixpoint term
idx : nat
args : list term
narg : nat
fn : term
H : unfold_fix mfix idx = Some (narg, fn)
H0 : is_constructor narg args = true
H1 : isApp (tFix mfix idx) = false
H2 : args <> []
H3 : Ast.wf (tFix mfix idx)
H4 : Forall Ast.wf args
Ast.wf (mkApps fn args)
apply unfold_fix_wf in H; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix : mfixpoint term
idx : nat
args : list term
narg : nat
fn : term
H : Ast.wf fn
H0 : is_constructor narg args = true
H1 : isApp (tFix mfix idx) = false
H2 : args <> []
H3 : Ast.wf (tFix mfix idx)
H4 : Forall Ast.wf args
Ast.wf (mkApps fn args)
eapply wf_mkApps; auto .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ip : case_info
p : predicate term
mfix : mfixpoint term
idx : nat
args : list term
brs : list (branch term)
narg : nat
fn : term
H : unfold_cofix mfix idx = Some (narg, fn)
H0 : Forall Ast.wf (pparams p)
H1 : Ast.wf (preturn p)
H2 : Ast.wf (mkApps (tCoFix mfix idx) args)
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf (tCase ip p (mkApps fn args) brs)
constructor ; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ip : case_info
p : predicate term
mfix : mfixpoint term
idx : nat
args : list term
brs : list (branch term)
narg : nat
fn : term
H : unfold_cofix mfix idx = Some (narg, fn)
H0 : Forall Ast.wf (pparams p)
H1 : Ast.wf (preturn p)
H2 : Ast.wf (mkApps (tCoFix mfix idx) args)
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf (mkApps fn args)
apply wf_mkApps_napp in H2 as [Hcof Hargs]; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ip : case_info
p : predicate term
mfix : mfixpoint term
idx : nat
args : list term
brs : list (branch term)
narg : nat
fn : term
H : unfold_cofix mfix idx = Some (narg, fn)
H0 : Forall Ast.wf (pparams p)
H1 : Ast.wf (preturn p)
Hcof : Ast.wf (tCoFix mfix idx)
Hargs : Forall Ast.wf args
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf (mkApps fn args)
apply unfold_cofix_wf in H; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ip : case_info
p : predicate term
mfix : mfixpoint term
idx : nat
args : list term
brs : list (branch term)
narg : nat
fn : term
H : Ast.wf fn
H0 : Forall Ast.wf (pparams p)
H1 : Ast.wf (preturn p)
Hcof : Ast.wf (tCoFix mfix idx)
Hargs : Forall Ast.wf args
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf (mkApps fn args)
apply wf_mkApps; intuition auto .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
p : projection
mfix : mfixpoint term
idx : nat
args : list term
narg : nat
fn : term
H : unfold_cofix mfix idx = Some (narg, fn)
H0 : Ast.wf (mkApps (tCoFix mfix idx) args)
Ast.wf (tProj p (mkApps fn args))
constructor ; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
p : projection
mfix : mfixpoint term
idx : nat
args : list term
narg : nat
fn : term
H : unfold_cofix mfix idx = Some (narg, fn)
H0 : Ast.wf (mkApps (tCoFix mfix idx) args)
Ast.wf (mkApps fn args)
apply wf_mkApps_napp in H0 as [Hcof Hargs]; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
p : projection
mfix : mfixpoint term
idx : nat
args : list term
narg : nat
fn : term
H : unfold_cofix mfix idx = Some (narg, fn)
Hcof : Ast.wf (tCoFix mfix idx)
Hargs : Forall Ast.wf args
Ast.wf (mkApps fn args)
apply unfold_cofix_wf in H; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
p : projection
mfix : mfixpoint term
idx : nat
args : list term
narg : nat
fn : term
H : Ast.wf fn
Hcof : Ast.wf (tCoFix mfix idx)
Hargs : Forall Ast.wf args
Ast.wf (mkApps fn args)
apply wf_mkApps; intuition auto .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
c : kername
u : Instance .t
decl : constant_body
body : term
H : declared_constant Σ c decl
H0 : cst_body decl = Some body
Ast.wf (subst_instance u body)
apply wf_subst_instance.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
c : kername
u : Instance .t
decl : constant_body
body : term
H : declared_constant Σ c decl
H0 : cst_body decl = Some body
Ast.wf body
unfold declared_constant in H.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
c : kername
u : Instance .t
decl : constant_body
body : term
H : lookup_env Σ c = Some (ConstantDecl decl)
H0 : cst_body decl = Some body
Ast.wf body
eapply lookup_on_global_env in H as [Σ' [onΣ' prf]]; eauto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
c : kername
u : Instance .t
decl : constant_body
body : term
H0 : cst_body decl = Some body
Σ' : global_env * universes_decl
onΣ' : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf : on_global_decl
(fun _ : global_env_ext => wf_decl_pred) Σ' c
(ConstantDecl decl)
Ast.wf body
destruct decl; simpl in *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
c : kername
u : Instance .t
cst_type0 : term
cst_body0 : option term
cst_universes0 : universes_decl
body : term
H0 : cst_body0 = Some body
Σ' : global_env * universes_decl
onΣ' : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf : on_constant_decl
(fun _ : global_env_ext => wf_decl_pred) Σ'
{|
cst_type := cst_type0;
cst_body := cst_body0;
cst_universes := cst_universes0 |}
Ast.wf body
subst cst_body0; simpl in *; compute in prf; intuition auto .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
i : inductive
pars, narg : nat
args : list term
u : Instance .t
arg : term
H : nth_error args (pars + narg) = Some arg
H0 : Ast.wf (mkApps (tConstruct i 0 u) args)
Ast.wf arg
apply wf_mkApps_inv in H0.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
i : inductive
pars, narg : nat
args : list term
u : Instance .t
arg : term
H : nth_error args (pars + narg) = Some arg
H0 : Forall Ast.wf args
Ast.wf arg
eapply nth_error_forall in H0; eauto .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
params : list term
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
params' : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y))
params params'
H : Forall Ast.wf
(pparams
{|
puinst := puinst;
pparams := params;
pcontext := pcontext;
preturn := preturn |})
H0 : Ast.wf
(Ast.preturn
{|
puinst := puinst;
pparams := params;
pcontext := pcontext;
preturn := preturn |})
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf
(tCase ind
{|
puinst := puinst;
pparams := params';
pcontext := pcontext;
preturn := preturn |} c brs)
simpl in *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
params : list term
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
params' : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y))
params params'
H : Forall Ast.wf params
H0 : Ast.wf preturn
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf
(tCase ind
{|
puinst := puinst;
pparams := params';
pcontext := pcontext;
preturn := preturn |} c brs)
induction X; constructor ; inv H; intuition auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
hd, hd' : term
tl : list term
H0 : Ast.wf preturn
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
H3 : Ast.wf hd
H4 : Forall Ast.wf tl
a : red1 Σ Γ hd hd'
H5 : Ast.wf hd'
Forall Ast.wf
(pparams
{|
puinst := puinst;
pparams := hd' :: tl;
pcontext := pcontext;
preturn := preturn |})
simpl .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
hd, hd' : term
tl : list term
H0 : Ast.wf preturn
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
H3 : Ast.wf hd
H4 : Forall Ast.wf tl
a : red1 Σ Γ hd hd'
H5 : Ast.wf hd'
Forall Ast.wf (hd' :: tl)
constructor ; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
hd : term
tl, tl' : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) tl
tl'
H0 : Ast.wf preturn
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
H3 : Ast.wf hd
H4 : Forall Ast.wf tl
H : Ast.wf
(tCase ind
{|
puinst := puinst;
pparams := tl';
pcontext := pcontext;
preturn := preturn |} c brs)
Forall Ast.wf
(pparams
{|
puinst := puinst;
pparams := hd :: tl';
pcontext := pcontext;
preturn := preturn |})
simpl in *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
hd : term
tl, tl' : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) tl
tl'
H0 : Ast.wf preturn
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
H3 : Ast.wf hd
H4 : Forall Ast.wf tl
H : Ast.wf
(tCase ind
{|
puinst := puinst;
pparams := tl';
pcontext := pcontext;
preturn := preturn |} c brs)
Forall Ast.wf (hd :: tl')
depelim H; simpl in *. cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
hd : term
tl, tl' : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) tl
tl'
H0 : Ast.wf preturn
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
H3 : Ast.wf hd
H4 : Forall Ast.wf tl
H : Forall Ast.wf tl'
H5 : Ast.wf preturn
H6 : Ast.wf c
H7 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall Ast.wf (hd :: tl')
constructor ; auto .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
params : list term
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
idecl : one_inductive_body
mdecl : mutual_inductive_body
isdecl : declared_inductive Σ (ci_ind ci) mdecl idecl
preturn' : term
H : red1 Σ
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) preturn preturn'
IHred1 : Forall wf_decl
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) ->
Ast.wf preturn -> Ast.wf preturn'
H0 : Forall Ast.wf
(pparams
{|
puinst := puinst;
pparams := params;
pcontext := pcontext;
preturn := preturn |})
H1 : Ast.wf
(Ast.preturn
{|
puinst := puinst;
pparams := params;
pcontext := pcontext;
preturn := preturn |})
H2 : Ast.wf c
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf
(tCase ci
{|
puinst := puinst;
pparams := params;
pcontext := pcontext;
preturn := preturn' |} c brs)
constructor ; auto ; simpl in *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
params : list term
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
idecl : one_inductive_body
mdecl : mutual_inductive_body
isdecl : declared_inductive Σ (ci_ind ci) mdecl idecl
preturn' : term
H : red1 Σ
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) preturn preturn'
IHred1 : Forall wf_decl
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) ->
Ast.wf preturn -> Ast.wf preturn'
H0 : Forall Ast.wf params
H1 : Ast.wf preturn
H2 : Ast.wf c
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf preturn'
apply IHred1; eauto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
params : list term
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
idecl : one_inductive_body
mdecl : mutual_inductive_body
isdecl : declared_inductive Σ (ci_ind ci) mdecl idecl
preturn' : term
H : red1 Σ
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) preturn preturn'
IHred1 : Forall wf_decl
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) ->
Ast.wf preturn -> Ast.wf preturn'
H0 : Forall Ast.wf params
H1 : Ast.wf preturn
H2 : Ast.wf c
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall wf_decl
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst pcontext)
apply app_Forall => //.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
params : list term
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
idecl : one_inductive_body
mdecl : mutual_inductive_body
isdecl : declared_inductive Σ (ci_ind ci) mdecl idecl
preturn' : term
H : red1 Σ
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) preturn preturn'
IHred1 : Forall wf_decl
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) ->
Ast.wf preturn -> Ast.wf preturn'
H0 : Forall Ast.wf params
H1 : Ast.wf preturn
H2 : Ast.wf c
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall wf_decl
(case_predicate_context
(ci_ind ci) mdecl idecl params puinst pcontext)
apply wf_case_predicate_context; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
params : list term
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
idecl : one_inductive_body
mdecl : mutual_inductive_body
isdecl : declared_inductive Σ (ci_ind ci) mdecl idecl
preturn' : term
H : red1 Σ
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) preturn preturn'
IHred1 : Forall wf_decl
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) ->
Ast.wf preturn -> Ast.wf preturn'
H0 : Forall Ast.wf params
H1 : Ast.wf preturn
H2 : Ast.wf c
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall wf_decl (ind_params mdecl)
eapply declared_inductive_wf_params in isdecl; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ci : case_info
params : list term
puinst : Instance .t
pcontext : list aname
preturn, c : term
brs : list (branch term)
idecl : one_inductive_body
mdecl : mutual_inductive_body
isdecl : declared_inductive Σ (ci_ind ci) mdecl idecl
preturn' : term
H : red1 Σ
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) preturn preturn'
IHred1 : Forall wf_decl
(Γ,,,
case_predicate_context
(ci_ind ci) mdecl idecl params puinst
pcontext) ->
Ast.wf preturn -> Ast.wf preturn'
H0 : Forall Ast.wf params
H1 : Ast.wf preturn
H2 : Ast.wf c
H3 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall wf_decl (ind_indices idecl)
eapply declared_inductive_wf_indices; eauto ; wf .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
p : predicate term
c : term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ (ci_ind ind) mdecl idecl
brs' : list (branch term)
X : OnOne2All
(fun (brctx : context ) (br br' : branch term) =>
(red1 Σ (Γ,,, brctx) (bbody br) (bbody br')
× (Forall wf_decl (Γ,,, brctx) ->
Ast.wf (bbody br) -> Ast.wf (bbody br'))) *
(bcontext br = bcontext br'))
(case_branches_contexts idecl p) brs brs'
H : Forall Ast.wf (pparams p)
H0 : Ast.wf (preturn p)
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Ast.wf (tCase ind p c brs')
constructor ; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
p : predicate term
c : term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ (ci_ind ind) mdecl idecl
brs' : list (branch term)
X : OnOne2All
(fun (brctx : context ) (br br' : branch term) =>
(red1 Σ (Γ,,, brctx) (bbody br) (bbody br')
× (Forall wf_decl (Γ,,, brctx) ->
Ast.wf (bbody br) -> Ast.wf (bbody br'))) *
(bcontext br = bcontext br'))
(case_branches_contexts idecl p) brs brs'
H : Forall Ast.wf (pparams p)
H0 : Ast.wf (preturn p)
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
Forall (fun x : branch term => Ast.wf (bbody x)) brs'
pose proof (wf_case_branches_context _ _ _ _ _ wfΣ isdecl H).cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ind : case_info
p : predicate term
c : term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ (ci_ind ind) mdecl idecl
brs' : list (branch term)
X : OnOne2All
(fun (brctx : context ) (br br' : branch term) =>
(red1 Σ (Γ,,, brctx) (bbody br) (bbody br')
× (Forall wf_decl (Γ,,, brctx) ->
Ast.wf (bbody br) -> Ast.wf (bbody br'))) *
(bcontext br = bcontext br'))
(case_branches_contexts idecl p) brs brs'
H : Forall Ast.wf (pparams p)
H0 : Ast.wf (preturn p)
H1 : Ast.wf c
H2 : Forall (fun x : branch term => Ast.wf (bbody x))
brs
H3 : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx)
(case_branches_contexts idecl p)
Forall (fun x : branch term => Ast.wf (bbody x)) brs'
solve_all. cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
ind : case_info
p : predicate term
c : term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ (ci_ind ind) mdecl idecl
brs' : list (branch term)
X : OnOne2All
(fun (brctx : context ) (br br' : branch term) =>
(red1 Σ (Γ,,, brctx) (bbody br) (bbody br')
× (Forall wf_decl (Γ,,, brctx) ->
Ast.wf (bbody br) -> Ast.wf (bbody br'))) *
(bcontext br = bcontext br'))
(case_branches_contexts idecl p) brs brs'
H : All Ast.wf (pparams p)
H0 : Ast.wf (preturn p)
H1 : Ast.wf c
H2 : All (fun x : branch term => Ast.wf (bbody x)) brs
H3 : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx)
(case_branches_contexts idecl p)
All (fun x : branch term => Ast.wf (bbody x)) brs'
eapply OnOne2All_All_mix_left in X; eauto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
ind : case_info
p : predicate term
c : term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ (ci_ind ind) mdecl idecl
brs' : list (branch term)
H : All Ast.wf (pparams p)
H0 : Ast.wf (preturn p)
H1 : Ast.wf c
H2 : All (fun x : branch term => Ast.wf (bbody x)) brs
H3 : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx)
(case_branches_contexts idecl p)
X : OnOne2All
(fun (i : context ) (x y : branch term) =>
(fun (brctx : context ) (br br' : branch term)
=>
(red1 Σ (Γ,,, brctx) (bbody br) (bbody br')
× (Forall wf_decl (Γ,,, brctx) ->
Ast.wf (bbody br) -> Ast.wf (bbody br'))) *
(bcontext br = bcontext br')) i x y *
(fun x0 : branch term => Ast.wf (bbody x0)) x)
(case_branches_contexts idecl p) brs brs'
All (fun x : branch term => Ast.wf (bbody x)) brs'
simpl in X.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
ind : case_info
p : predicate term
c : term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ (ci_ind ind) mdecl idecl
brs' : list (branch term)
H : All Ast.wf (pparams p)
H0 : Ast.wf (preturn p)
H1 : Ast.wf c
H2 : All (fun x : branch term => Ast.wf (bbody x)) brs
H3 : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx)
(case_branches_contexts idecl p)
X : OnOne2All
(fun (i : context ) (x y : branch term) =>
((red1 Σ (Γ,,, i) (bbody x) (bbody y)
× (Forall wf_decl (Γ,,, i) ->
Ast.wf (bbody x) -> Ast.wf (bbody y)))
× bcontext x = bcontext y) *
Ast.wf (bbody x))
(case_branches_contexts idecl p) brs brs'
All (fun x : branch term => Ast.wf (bbody x)) brs'
forward H3. cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
ind : case_info
p : predicate term
c : term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ (ci_ind ind) mdecl idecl
brs' : list (branch term)
H : All Ast.wf (pparams p)
H0 : Ast.wf (preturn p)
H1 : Ast.wf c
H2 : All (fun x : branch term => Ast.wf (bbody x)) brs
H3 : Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl) ->
Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx)
(case_branches_contexts idecl p)
X : OnOne2All
(fun (i : context ) (x y : branch term) =>
((red1 Σ (Γ,,, i) (bbody x) (bbody y)
× (Forall wf_decl (Γ,,, i) ->
Ast.wf (bbody x) -> Ast.wf (bbody y)))
× bcontext x = bcontext y) *
Ast.wf (bbody x))
(case_branches_contexts idecl p) brs brs'
Forall
(fun ctor : constructor_body =>
Forall wf_decl (cstr_args ctor))
(ind_ctors idecl)
eapply declared_inductive_wf_ctors; eauto ; wf .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
ind : case_info
p : predicate term
c : term
brs : list (branch term)
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ (ci_ind ind) mdecl idecl
brs' : list (branch term)
H : All Ast.wf (pparams p)
H0 : Ast.wf (preturn p)
H1 : Ast.wf c
H2 : All (fun x : branch term => Ast.wf (bbody x)) brs
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx)
(case_branches_contexts idecl p)
X : OnOne2All
(fun (i : context ) (x y : branch term) =>
((red1 Σ (Γ,,, i) (bbody x) (bbody y)
× (Forall wf_decl (Γ,,, i) ->
Ast.wf (bbody x) -> Ast.wf (bbody y)))
× bcontext x = bcontext y) *
Ast.wf (bbody x))
(case_branches_contexts idecl p) brs brs'
All (fun x : branch term => Ast.wf (bbody x)) brs'
clear -wfΓ X H2 H3.Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
brs : list (branch term)
idecl : one_inductive_body
brs' : list (branch term)
H2 : All (fun x : branch term => Ast.wf (bbody x)) brs
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx)
(case_branches_contexts idecl p)
X : OnOne2All
(fun (i : context ) (x y : branch term) =>
((red1 Σ (Γ,,, i) (bbody x) (bbody y)
× (Forall wf_decl (Γ,,, i) ->
Ast.wf (bbody x) -> Ast.wf (bbody y)))
× bcontext x = bcontext y) *
Ast.wf (bbody x))
(case_branches_contexts idecl p) brs brs'
All (fun x : branch term => Ast.wf (bbody x)) brs'
induction X; try congruence .Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
H2 : All (fun x : branch term => Ast.wf (bbody x))
(hd :: tl)
b : context
bs : list context
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) (b :: bs)
hd' : branch term
p0 : ((red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
× (Forall wf_decl (Γ,,, b) ->
Ast.wf (bbody hd) -> Ast.wf (bbody hd')))
× bcontext hd = bcontext hd') *
Ast.wf (bbody hd)
e : #|bs| = #|tl|
All (fun x : branch term => Ast.wf (bbody x))
(hd' :: tl)
inv H2. Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
b : context
bs : list context
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) (b :: bs)
hd' : branch term
p0 : ((red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
× (Forall wf_decl (Γ,,, b) ->
Ast.wf (bbody hd) -> Ast.wf (bbody hd')))
× bcontext hd = bcontext hd') *
Ast.wf (bbody hd)
e : #|bs| = #|tl|
H : Ast.wf (bbody hd)
X : All (fun x : branch term => Ast.wf (bbody x)) tl
All (fun x : branch term => Ast.wf (bbody x))
(hd' :: tl)
destruct p0 as [[? ?] ?].Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
b : context
bs : list context
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) (b :: bs)
hd' : branch term
p0 : red1 Σ (Γ,,, b) (bbody hd) (bbody hd') *
(Forall wf_decl (Γ,,, b) ->
Ast.wf (bbody hd) -> Ast.wf (bbody hd'))
e0 : bcontext hd = bcontext hd'
w : Ast.wf (bbody hd)
e : #|bs| = #|tl|
H : Ast.wf (bbody hd)
X : All (fun x : branch term => Ast.wf (bbody x)) tl
All (fun x : branch term => Ast.wf (bbody x))
(hd' :: tl)
constructor ; intuition eauto .Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
b : context
bs : list context
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) (b :: bs)
hd' : branch term
e0 : bcontext hd = bcontext hd'
w : Ast.wf (bbody hd)
e : #|bs| = #|tl|
H : Ast.wf (bbody hd)
X : All (fun x : branch term => Ast.wf (bbody x)) tl
a : red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
b0 : Forall wf_decl (Γ,,, b) ->
Ast.wf (bbody hd) -> Ast.wf (bbody hd')
Ast.wf (bbody hd')
apply b0; auto .Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
b : context
bs : list context
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) (b :: bs)
hd' : branch term
e0 : bcontext hd = bcontext hd'
w : Ast.wf (bbody hd)
e : #|bs| = #|tl|
H : Ast.wf (bbody hd)
X : All (fun x : branch term => Ast.wf (bbody x)) tl
a : red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
b0 : Forall wf_decl (Γ,,, b) ->
Ast.wf (bbody hd) -> Ast.wf (bbody hd')
Forall wf_decl (Γ,,, b)
depelim H3. Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
b : context
bs : list context
H : Forall wf_decl b
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) bs
hd' : branch term
e0 : bcontext hd = bcontext hd'
w : Ast.wf (bbody hd)
e : #|bs| = #|tl|
H0 : Ast.wf (bbody hd)
X : All (fun x : branch term => Ast.wf (bbody x)) tl
a : red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
b0 : Forall wf_decl (Γ,,, b) ->
Ast.wf (bbody hd) -> Ast.wf (bbody hd')
Forall wf_decl (Γ,,, b)
apply app_Forall => //.Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
b : context
bs : list context
H : Forall wf_decl b
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) bs
hd' : branch term
e0 : bcontext hd = bcontext hd'
w : Ast.wf (bbody hd)
e : #|bs| = #|tl|
H0 : Ast.wf (bbody hd)
X : All (fun x : branch term => Ast.wf (bbody x)) tl
a : red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
b0 : Forall wf_decl (Γ,,, b) ->
Ast.wf (bbody hd) -> Ast.wf (bbody hd')
Forall wf_decl Γ
solve_all. Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
H2 : All (fun x : branch term => Ast.wf (bbody x))
(hd :: tl)
b : context
bs : list context
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) (b :: bs)
tl' : list (branch term)
X : OnOne2All
(fun (i : context ) (x y : branch term) =>
((red1 Σ (Γ,,, i) (bbody x) (bbody y)
× (Forall wf_decl (Γ,,, i) ->
Ast.wf (bbody x) -> Ast.wf (bbody y)))
× bcontext x = bcontext y) *
Ast.wf (bbody x)) bs tl tl'
IHX : All (fun x : branch term => Ast.wf (bbody x)) tl ->
Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) bs ->
All (fun x : branch term => Ast.wf (bbody x))
tl'
All (fun x : branch term => Ast.wf (bbody x))
(hd :: tl')
inv H2; constructor ; intuition auto . Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
b : context
bs : list context
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) (b :: bs)
tl' : list (branch term)
X : OnOne2All
(fun (i : context ) (x y : branch term) =>
((red1 Σ (Γ,,, i) (bbody x) (bbody y)
× (Forall wf_decl (Γ,,, i) ->
Ast.wf (bbody x) -> Ast.wf (bbody y)))
× bcontext x = bcontext y) *
Ast.wf (bbody x)) bs tl tl'
H : Ast.wf (bbody hd)
X0 : All (fun x : branch term => Ast.wf (bbody x)) tl
X1 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) bs ->
All (fun x : branch term => Ast.wf (bbody x)) tl'
All (fun x : branch term => Ast.wf (bbody x)) tl'
apply X1 => //.Σ : global_env
Γ : context
wfΓ : All wf_decl Γ
p : predicate term
idecl : one_inductive_body
hd : branch term
tl : list (branch term)
b : context
bs : list context
H3 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) (b :: bs)
tl' : list (branch term)
X : OnOne2All
(fun (i : context ) (x y : branch term) =>
((red1 Σ (Γ,,, i) (bbody x) (bbody y)
× (Forall wf_decl (Γ,,, i) ->
Ast.wf (bbody x) -> Ast.wf (bbody y)))
× bcontext x = bcontext y) *
Ast.wf (bbody x)) bs tl tl'
H : Ast.wf (bbody hd)
X0 : All (fun x : branch term => Ast.wf (bbody x)) tl
X1 : Forall
(fun ctx : list context_decl =>
Forall wf_decl ctx) bs ->
All (fun x : branch term => Ast.wf (bbody x)) tl'
Forall
(fun ctx : list context_decl => Forall wf_decl ctx)
bs
now depelim H3.
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
M1 : term
M2 : list term
N1 : term
H : red1 Σ Γ M1 N1
IHred1 : Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
H0 : isApp M1 = false
H1 : M2 <> []
H2 : Ast.wf M1
H3 : Forall Ast.wf M2
Ast.wf (mkApps N1 M2)
now eapply wf_mkApps.
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
M2 : list term
M1 : term
N2 : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2
N2
H : isApp M1 = false
H0 : M2 <> []
H1 : Ast.wf M1
H2 : Forall Ast.wf M2
Ast.wf (tApp M1 N2)
constructor ; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
M2 : list term
M1 : term
N2 : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2
N2
H : isApp M1 = false
H0 : M2 <> []
H1 : Ast.wf M1
H2 : Forall Ast.wf M2
N2 <> []
induction X; auto ; congruence .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
M2 : list term
M1 : term
N2 : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2
N2
H : isApp M1 = false
H0 : M2 <> []
H1 : Ast.wf M1
H2 : Forall Ast.wf M2
Forall Ast.wf N2
clear H H1 H0.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
M2 : list term
M1 : term
N2 : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2
N2
H2 : Forall Ast.wf M2
Forall Ast.wf N2
induction X; inv H2; constructor ; intuition auto ; try congruence .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ev : nat
l, l' : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) l
l'
H : Forall Ast.wf l
Ast.wf (tEvar ev l')
constructor .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
ev : nat
l, l' : list term
X : OnOne2
(fun x y : term =>
red1 Σ Γ x y *
(Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) l
l'
H : Forall Ast.wf l
Forall Ast.wf l'
induction X; inv H; constructor ; intuition auto .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ Γ (dtype x) (dtype y)
× (Forall wf_decl Γ ->
Ast.wf (dtype x) -> Ast.wf (dtype y))) *
((dname x, dbody x, rarg x) =
(dname y, dbody y, rarg y))) mfix0 mfix1
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tFix mfix1 idx)
constructor ; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ Γ (dtype x) (dtype y)
× (Forall wf_decl Γ ->
Ast.wf (dtype x) -> Ast.wf (dtype y))) *
((dname x, dbody x, rarg x) =
(dname y, dbody y, rarg y))) mfix0 mfix1
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
induction X; inv H; constructor ; intuition auto ; congruence .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tFix mfix1 idx)
constructor ; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
solve_all. cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
pose proof H as H'.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H, H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
revert H.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0 ->
All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
apply (OnOne2_All_All X).cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
forall x y : def term,
(red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y)))
× (dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y) ->
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
Ast.wf (dtype y) /\ Ast.wf (dbody y)
clear X.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
forall x y : def term,
(red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y)))
× (dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y) ->
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
Ast.wf (dtype y) /\ Ast.wf (dbody y)
intros [na bo ty ra] [nb bb tb rb] [[r ih] e] [? ?].cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
na : aname
bo, ty : term
ra : nat
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0)
(dbody
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |})
(dbody
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |})
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf
(dbody
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |}) ->
Ast.wf
(dbody
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |})
e : (dname
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |},
dtype
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |},
rarg
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |}) =
(dname
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |},
dtype
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |},
rarg
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |})
H : Ast.wf
(dtype
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |})
H0 : Ast.wf
(dbody
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |})
Ast.wf
(dtype
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |}) /\
Ast.wf
(dbody
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |})
simpl in *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
na : aname
bo, ty : term
ra : nat
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
e : (na, bo, ra) = (nb, bb, rb)
H : Ast.wf bo
H0 : Ast.wf ty
Ast.wf bb /\ Ast.wf tb
inversion e.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
na : aname
bo, ty : term
ra : nat
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
e : (na, bo, ra) = (nb, bb, rb)
H : Ast.wf bo
H0 : Ast.wf ty
H2 : na = nb
H3 : bo = bb
H4 : ra = rb
Ast.wf bb /\ Ast.wf tb
subst .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
e : (nb, bb, rb) = (nb, bb, rb)
H0 : Ast.wf ty
Ast.wf bb /\ Ast.wf tb
clear e.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Ast.wf bb /\ Ast.wf tb
intuition eauto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Ast.wf tb
eapply ih.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Forall wf_decl (Γ,,, fix_context mfix0)
2 : assumption .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Forall wf_decl (Γ,,, fix_context mfix0)
solve_all. cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl (Γ,,, fix_context mfix0)
apply All_app_inv.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl (fix_context mfix0)
2 : assumption .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl (fix_context mfix0)
unfold fix_context.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl
(List.rev
(mapi
(fun (i : nat) (d : def term) =>
vass (dname d) (lift0 i (dtype d))) mfix0))
apply All_rev.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl
(mapi
(fun (i : nat) (d : def term) =>
vass (dname d) (lift0 i (dtype d))) mfix0)
eapply All_mapi.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Alli
(fun (i : nat) (x : def term) =>
wf_decl (vass (dname x) (lift0 i (dtype x)))) 0
mfix0
eapply All_Alli.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All ?P mfix0
1 : exact H'.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
forall (n : nat) (x : def term),
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) x ->
wf_decl (vass (dname x) (lift0 n (dtype x)))
cbn .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
forall (n : nat) (x : def term),
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
wf_decl (vass (dname x) (lift0 n (dtype x)))
unfold wf_decl.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
forall (n : nat) (x : def term),
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
match
decl_body (vass (dname x) (lift0 n (dtype x)))
with
| Some b => Ast.wf b
| None => True
end /\
Ast.wf
(decl_type (vass (dname x) (lift0 n (dtype x))))
simpl .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
forall (n : nat) (x : def term),
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
True /\ Ast.wf (lift0 n (dtype x))
intros ? [? ? ? ?] ?.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (BasicAst.dtype def) /\
Ast.wf (BasicAst.dbody def)) mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
n : nat
dname : aname
dtype, dbody : term
rarg : nat
H1 : Ast.wf
(BasicAst.dtype
{|
dname := dname;
dtype := dtype;
dbody := dbody;
rarg := rarg |}) /\
Ast.wf
(BasicAst.dbody
{|
dname := dname;
dtype := dtype;
dbody := dbody;
rarg := rarg |})
True /\
Ast.wf
(lift0 n
(BasicAst.dtype
{|
dname := dname;
dtype := dtype;
dbody := dbody;
rarg := rarg |}))
simpl in *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (BasicAst.dtype def) /\
Ast.wf (BasicAst.dbody def)) mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
n : nat
dname : aname
dtype, dbody : term
rarg : nat
H1 : Ast.wf dtype /\ Ast.wf dbody
True /\ Ast.wf (lift0 n dtype)
intuition eauto with wf .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ Γ (dtype x) (dtype y)
× (Forall wf_decl Γ ->
Ast.wf (dtype x) -> Ast.wf (dtype y))) *
((dname x, dbody x, rarg x) =
(dname y, dbody y, rarg y))) mfix0 mfix1
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tCoFix mfix1 idx)
constructor ; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ Γ (dtype x) (dtype y)
× (Forall wf_decl Γ ->
Ast.wf (dtype x) -> Ast.wf (dtype y))) *
((dname x, dbody x, rarg x) =
(dname y, dbody y, rarg y))) mfix0 mfix1
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
induction X; inv H; constructor ; intuition auto ; congruence .
- cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tCoFix mfix1 idx)
constructor ; auto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : Forall wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H : Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
solve_all. cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
pose proof H as H'.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H, H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
revert H.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0 ->
All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
apply (OnOne2_All_All X).cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
X : OnOne2
(fun x y : def term =>
(red1 Σ (Γ,,, fix_context mfix0)
(dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y))) *
((dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y))) mfix0 mfix1
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
forall x y : def term,
(red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y)))
× (dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y) ->
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
Ast.wf (dtype y) /\ Ast.wf (dbody y)
clear X.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
forall x y : def term,
(red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y)
× (Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf (dbody x) -> Ast.wf (dbody y)))
× (dname x, dtype x, rarg x) =
(dname y, dtype y, rarg y) ->
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
Ast.wf (dtype y) /\ Ast.wf (dbody y)
intros [na bo ty ra] [nb bb tb rb] [[r ih] e] [? ?].cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
na : aname
bo, ty : term
ra : nat
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0)
(dbody
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |})
(dbody
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |})
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf
(dbody
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |}) ->
Ast.wf
(dbody
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |})
e : (dname
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |},
dtype
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |},
rarg
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |}) =
(dname
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |},
dtype
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |},
rarg
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |})
H : Ast.wf
(dtype
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |})
H0 : Ast.wf
(dbody
{|
dname := na;
dtype := bo;
dbody := ty;
rarg := ra |})
Ast.wf
(dtype
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |}) /\
Ast.wf
(dbody
{|
dname := nb;
dtype := bb;
dbody := tb;
rarg := rb |})
simpl in *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
na : aname
bo, ty : term
ra : nat
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
e : (na, bo, ra) = (nb, bb, rb)
H : Ast.wf bo
H0 : Ast.wf ty
Ast.wf bb /\ Ast.wf tb
inversion e.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
na : aname
bo, ty : term
ra : nat
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
e : (na, bo, ra) = (nb, bb, rb)
H : Ast.wf bo
H0 : Ast.wf ty
H2 : na = nb
H3 : bo = bb
H4 : ra = rb
Ast.wf bb /\ Ast.wf tb
subst .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
e : (nb, bb, rb) = (nb, bb, rb)
H0 : Ast.wf ty
Ast.wf bb /\ Ast.wf tb
clear e.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Ast.wf bb /\ Ast.wf tb
intuition eauto .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Ast.wf tb
eapply ih.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Forall wf_decl (Γ,,, fix_context mfix0)
2 : assumption .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Forall wf_decl (Γ,,, fix_context mfix0)
solve_all. cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl (Γ,,, fix_context mfix0)
apply All_app_inv.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl (fix_context mfix0)
2 : assumption .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl (fix_context mfix0)
unfold fix_context.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl
(List.rev
(mapi
(fun (i : nat) (d : def term) =>
vass (dname d) (lift0 i (dtype d))) mfix0))
apply All_rev.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All wf_decl
(mapi
(fun (i : nat) (d : def term) =>
vass (dname d) (lift0 i (dtype d))) mfix0)
eapply All_mapi.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
Alli
(fun (i : nat) (x : def term) =>
wf_decl (vass (dname x) (lift0 i (dtype x)))) 0
mfix0
eapply All_Alli.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
All ?P mfix0
1 : exact H'.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
forall (n : nat) (x : def term),
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) x ->
wf_decl (vass (dname x) (lift0 n (dtype x)))
cbn .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
forall (n : nat) (x : def term),
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
wf_decl (vass (dname x) (lift0 n (dtype x)))
unfold wf_decl.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
forall (n : nat) (x : def term),
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
match
decl_body (vass (dname x) (lift0 n (dtype x)))
with
| Some b => Ast.wf b
| None => True
end /\
Ast.wf
(decl_type (vass (dname x) (lift0 n (dtype x))))
simpl .cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def))
mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
forall (n : nat) (x : def term),
Ast.wf (dtype x) /\ Ast.wf (dbody x) ->
True /\ Ast.wf (lift0 n (dtype x))
intros ? [? ? ? ?] ?.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (BasicAst.dtype def) /\
Ast.wf (BasicAst.dbody def)) mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
n : nat
dname : aname
dtype, dbody : term
rarg : nat
H1 : Ast.wf
(BasicAst.dtype
{|
dname := dname;
dtype := dtype;
dbody := dbody;
rarg := rarg |}) /\
Ast.wf
(BasicAst.dbody
{|
dname := dname;
dtype := dtype;
dbody := dbody;
rarg := rarg |})
True /\
Ast.wf
(lift0 n
(BasicAst.dtype
{|
dname := dname;
dtype := dtype;
dbody := dbody;
rarg := rarg |}))
simpl in *.cf : checker_flags
Σ : global_env
wfΣ : on_global_env
(fun _ : global_env_ext => wf_decl_pred) Σ
Γ : context
wfΓ : All wf_decl Γ
mfix0 : list (def term)
idx : nat
mfix1 : list (def term)
H' : All
(fun def : def term =>
Ast.wf (BasicAst.dtype def) /\
Ast.wf (BasicAst.dbody def)) mfix0
ty : term
nb : aname
bb, tb : term
rb : nat
r : red1 Σ (Γ,,, fix_context mfix0) ty tb
ih : Forall wf_decl (Γ,,, fix_context mfix0) ->
Ast.wf ty -> Ast.wf tb
H : Ast.wf bb
H0 : Ast.wf ty
n : nat
dname : aname
dtype, dbody : term
rarg : nat
H1 : Ast.wf dtype /\ Ast.wf dbody
True /\ Ast.wf (lift0 n dtype)
intuition eauto with wf .
Qed .
Lemma wf_inds mind bodies u : Forall Ast.wf (inds mind u bodies).mind : kername
bodies : list one_inductive_body
u : Instance .t
Forall Ast.wf (inds mind u bodies)
Proof .mind : kername
bodies : list one_inductive_body
u : Instance .t
Forall Ast.wf (inds mind u bodies)
unfold inds.mind : kername
bodies : list one_inductive_body
u : Instance .t
Forall Ast.wf
((fix aux (n : nat) : list term :=
match n with
| 0 => []
| S n0 =>
tInd
{|
inductive_mind := mind;
inductive_ind := n0 |} u ::
aux n0
end ) #|bodies|)
generalize #|bodies|.mind : kername
bodies : list one_inductive_body
u : Instance .t
forall n : nat,
Forall Ast.wf
((fix aux (n0 : nat) :
list term :=
match n0 with
| 0 => []
| S n1 =>
tInd
{|
inductive_mind := mind;
inductive_ind := n1 |} u ::
aux n1
end ) n)
induction n.mind : kername
bodies : list one_inductive_body
u : Instance .t
Forall Ast.wf []
constructor .mind : kername
bodies : list one_inductive_body
u : Instance .t
n : nat
IHn : Forall Ast.wf
((fix aux (n0 : nat) :
list term :=
match n0 with
| 0 => []
| S n1 =>
tInd
{|
inductive_mind := mind;
inductive_ind := n1 |} u ::
aux n1
end ) n)
Forall Ast.wf
(tInd
{| inductive_mind := mind; inductive_ind := n |}
u
:: (fix aux (n0 : nat) :
list term :=
match n0 with
| 0 => []
| S n1 =>
tInd
{|
inductive_mind := mind;
inductive_ind := n1 |} u ::
aux n1
end ) n)
constructor ; auto .mind : kername
bodies : list one_inductive_body
u : Instance .t
n : nat
IHn : Forall Ast.wf
((fix aux (n0 : nat) :
list term :=
match n0 with
| 0 => []
| S n1 =>
tInd
{|
inductive_mind := mind;
inductive_ind := n1 |} u ::
aux n1
end ) n)
Ast.wf
(tInd
{| inductive_mind := mind; inductive_ind := n |}
u)
wf .
Qed .
Hint Resolve wf_inds : wf .
Lemma wf_projs ind npars p : Forall Ast.wf (projs ind npars p).ind : inductive
npars, p : nat
Forall Ast.wf (projs ind npars p)
Proof .ind : inductive
npars, p : nat
Forall Ast.wf (projs ind npars p)
unfold projs.ind : inductive
npars, p : nat
Forall Ast.wf
((fix
projs (ind0 : inductive)
(npars0 k : nat) {struct k} :
list term :=
match k with
| 0 => []
| S k' =>
tProj (ind0, npars0, k') (tRel 0 )
:: projs ind0 npars0 k'
end ) ind npars p)
induction p; constructor ; wf .
Qed .
Ltac specialize_goal :=
repeat match goal with
| H : ?P -> _, H' : ?P |- _ => specialize (H H')
end .
Lemma wf_lift_wf n k t : Ast.wf (lift n k t) -> Ast.wf t.Ast.wf (lift n k t) -> Ast.wf t
Proof .Ast.wf (lift n k t) -> Ast.wf t
induction t in n, k |- * using term_forall_list_ind; simpl in *;
intros Hwf; inv Hwf; try constructor ; eauto ;
repeat (unfold snd, on_snd in *; simpl in *; solve_all).n, k : nat
t : term
l : list term
IHt : forall n0 k0 : nat, Ast.wf (lift n0 k0 t) -> Ast.wf t
H0 : isApp (lift n k t) = false
H1 : map (lift n k) l = [] -> False
H2 : Ast.wf (lift n k t)
H3 : All
(fun x : term =>
(forall n0 k0 : nat,
Ast.wf (lift n0 k0 x) -> Ast.wf x) *
Ast.wf (lift n k x)) l
isApp t = false
- n, k : nat
t : term
l : list term
IHt : forall n0 k0 : nat, Ast.wf (lift n0 k0 t) -> Ast.wf t
H0 : isApp (lift n k t) = false
H1 : map (lift n k) l = [] -> False
H2 : Ast.wf (lift n k t)
H3 : All
(fun x : term =>
(forall n0 k0 : nat,
Ast.wf (lift n0 k0 x) -> Ast.wf x) *
Ast.wf (lift n k x)) l
isApp t = false
destruct t; try reflexivity .n, k : nat
t : term
args, l : list term
IHt : forall n0 k0 : nat,
Ast.wf (lift n0 k0 (tApp t args)) ->
Ast.wf (tApp t args)
H0 : isApp (lift n k (tApp t args)) = false
H1 : map (lift n k) l = [] -> False
H2 : Ast.wf (lift n k (tApp t args))
H3 : All
(fun x : term =>
(forall n0 k0 : nat,
Ast.wf (lift n0 k0 x) -> Ast.wf x) *
Ast.wf (lift n k x)) l
isApp (tApp t args) = false
discriminate .
- n, k : nat
t : term
l : list term
IHt : forall n0 k0 : nat,
Ast.wf (lift n0 k0 t) -> Ast.wf t
H0 : isApp (lift n k t) = false
H1 : map (lift n k) l = [] -> False
H2 : Ast.wf (lift n k t)
H3 : All
(fun x : term =>
(forall n0 k0 : nat,
Ast.wf (lift n0 k0 x) -> Ast.wf x) *
Ast.wf (lift n k x)) l
H : l = []
False
destruct l; simpl in *; congruence .
Qed .
Lemma on_inductive_wf_params {cf :checker_flags} {Σ : global_env_ext} {ind mdecl } :
forall (oib : on_inductive
(lift_typing (fun _ _ (t T : term) => Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl),
Forall wf_decl (ind_params mdecl).cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
on_inductive
(lift_typing
(fun (_ : global_env_ext) (_ : context )
(t T : term) => Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl ->
Forall wf_decl (ind_params mdecl)
Proof .cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
on_inductive
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl ->
Forall wf_decl (ind_params mdecl)
intros oib.cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
oib : on_inductive
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(inductive_mind ind) mdecl
Forall wf_decl (ind_params mdecl)
apply onParams in oib.cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
oib : on_context
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ
(ind_params mdecl)
Forall wf_decl (ind_params mdecl)
red in oib.cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
oib : TemplateEnvTyping.All_local_env
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ)
(ind_params mdecl)
Forall wf_decl (ind_params mdecl)
induction (ind_params mdecl) as [|[? [] ?] ?]; simpl in oib; inv oib; constructor ;
try red in X0; try red in X1; try red ; simpl ; intuition auto .cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
decl_name : aname
decl_type : term
c : list context_decl
X : TemplateEnvTyping.All_local_env
(lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ) c
X0 : ∑ s : Universe .t,
Ast.wf decl_type /\ Ast.wf (tSort s)
H : Forall wf_decl c
Ast.wf decl_type
destruct X0; intuition auto .
Qed .
Lemma wf_smash_context Γ Δ : Forall wf_decl Γ -> Forall wf_decl Δ ->
Forall wf_decl (smash_context Δ Γ).Forall wf_decl Γ ->
Forall wf_decl Δ -> Forall wf_decl (smash_context Δ Γ)
Proof .Forall wf_decl Γ ->
Forall wf_decl Δ -> Forall wf_decl (smash_context Δ Γ)
intros wfΓ; induction wfΓ in Δ |- *; intros wfΔ; simpl ; auto .Δ : list context_decl
x : context_decl
l : list context_decl
H : wf_decl x
wfΓ : Forall wf_decl l
IHwfΓ : forall Δ0 : list context_decl,
Forall wf_decl Δ0 ->
Forall wf_decl (smash_context Δ0 l)
wfΔ : Forall wf_decl Δ
Forall wf_decl
match x with
| {| decl_body := Some b |} =>
smash_context (subst_context [b] 0 Δ) l
| {| decl_body := None |} =>
smash_context (Δ ++ [x]) l
end
destruct x as [? [] ?]; simpl .Δ : list context_decl
decl_name : aname
t, decl_type : term
l : list context_decl
H : wf_decl
{|
decl_name := decl_name;
decl_body := Some t;
decl_type := decl_type |}
wfΓ : Forall wf_decl l
IHwfΓ : forall Δ0 : list context_decl,
Forall wf_decl Δ0 ->
Forall wf_decl (smash_context Δ0 l)
wfΔ : Forall wf_decl Δ
Forall wf_decl
(smash_context (subst_context [t] 0 Δ) l)
apply IHwfΓ.Δ : list context_decl
decl_name : aname
t, decl_type : term
l : list context_decl
H : wf_decl
{|
decl_name := decl_name;
decl_body := Some t;
decl_type := decl_type |}
wfΓ : Forall wf_decl l
IHwfΓ : forall Δ0 : list context_decl,
Forall wf_decl Δ0 ->
Forall wf_decl (smash_context Δ0 l)
wfΔ : Forall wf_decl Δ
Forall wf_decl (subst_context [t] 0 Δ)
eapply wf_subst_context; auto .Δ : list context_decl
decl_name : aname
t, decl_type : term
l : list context_decl
H : wf_decl
{|
decl_name := decl_name;
decl_body := Some t;
decl_type := decl_type |}
wfΓ : Forall wf_decl l
IHwfΓ : forall Δ0 : list context_decl,
Forall wf_decl Δ0 ->
Forall wf_decl (smash_context Δ0 l)
wfΔ : Forall wf_decl Δ
Forall Ast.wf [t]
constructor ; auto .Δ : list context_decl
decl_name : aname
t, decl_type : term
l : list context_decl
H : wf_decl
{|
decl_name := decl_name;
decl_body := Some t;
decl_type := decl_type |}
wfΓ : Forall wf_decl l
IHwfΓ : forall Δ0 : list context_decl,
Forall wf_decl Δ0 ->
Forall wf_decl (smash_context Δ0 l)
wfΔ : Forall wf_decl Δ
Ast.wf t
apply H.Δ : list context_decl
decl_name : aname
decl_type : term
l : list context_decl
H : wf_decl
{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |}
wfΓ : Forall wf_decl l
IHwfΓ : forall Δ0 : list context_decl,
Forall wf_decl Δ0 ->
Forall wf_decl (smash_context Δ0 l)
wfΔ : Forall wf_decl Δ
Forall wf_decl
(smash_context
(Δ ++
[{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |}]) l)
eapply IHwfΓ.Δ : list context_decl
decl_name : aname
decl_type : term
l : list context_decl
H : wf_decl
{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |}
wfΓ : Forall wf_decl l
IHwfΓ : forall Δ0 : list context_decl,
Forall wf_decl Δ0 ->
Forall wf_decl (smash_context Δ0 l)
wfΔ : Forall wf_decl Δ
Forall wf_decl
(Δ ++
[{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |}])
eapply All_Forall.Δ : list context_decl
decl_name : aname
decl_type : term
l : list context_decl
H : wf_decl
{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |}
wfΓ : Forall wf_decl l
IHwfΓ : forall Δ0 : list context_decl,
Forall wf_decl Δ0 ->
Forall wf_decl (smash_context Δ0 l)
wfΔ : Forall wf_decl Δ
All wf_decl
(Δ ++
[{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |}])
apply All_app_inv; auto .Δ : list context_decl
decl_name : aname
decl_type : term
l : list context_decl
H : wf_decl
{|
decl_name := decl_name;
decl_body := None;
decl_type := decl_type |}
wfΓ : Forall wf_decl l
IHwfΓ : forall Δ0 : list context_decl,
Forall wf_decl Δ0 ->
Forall wf_decl (smash_context Δ0 l)
wfΔ : Forall wf_decl Δ
All wf_decl Δ
now apply Forall_All in wfΔ.
Qed .
(* Lemma smash_context_app Γ Δ : smash_context Δ Γ = smash_context [] Γ ++ Δ.
Proof.
induction Γ in Δ |- *; simpl; auto.
destruct a as [? [] ?]; simpl; auto. rewrite IHΓ.
rewrite IHΓ. *)
Lemma declared_projection_wf {cf :checker_flags}:
forall (Σ : global_env) (p : projection)
(mdecl : mutual_inductive_body) (idecl : one_inductive_body) (pdecl : ident * term),
declared_projection Σ p mdecl idecl pdecl ->
Forall_decls_typing (fun (_ : global_env_ext) (_ : context ) (t T : term) => Ast.wf t /\ Ast.wf T) Σ ->
Ast.wf (snd pdecl).forall (Σ : global_env) (p : projection)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body) (pdecl : ident × term),
declared_projection Σ p mdecl idecl pdecl ->
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ -> Ast.wf pdecl.2
Proof .forall (Σ : global_env) (p : projection)
(mdecl : mutual_inductive_body)
(idecl : one_inductive_body) (pdecl : ident × term),
declared_projection Σ p mdecl idecl pdecl ->
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ -> Ast.wf pdecl.2
intros Σ p mdecl idecl pdecl isdecl X.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ p mdecl idecl pdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Ast.wf pdecl.2
destruct isdecl as [[Hmdecl Hidecl] Hpdecl].cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
Hmdecl : declared_minductive Σ (inductive_mind p.1 .1 )
mdecl
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind p.1 .1 ) =
Some idecl
Hpdecl : nth_error (ind_projs idecl) p.2 = Some pdecl /\
ind_npars mdecl = p.1 .2
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Ast.wf pdecl.2
eapply lookup_on_global_env in Hmdecl as [Σ' [wfΣ' prf]]; eauto .cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind p.1 .1 ) =
Some idecl
Hpdecl : nth_error (ind_projs idecl) p.2 = Some pdecl /\
ind_npars mdecl = p.1 .2
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_global_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 )
(InductiveDecl mdecl)
Ast.wf pdecl.2
red in prf.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind p.1 .1 ) =
Some idecl
Hpdecl : nth_error (ind_projs idecl) p.2 = Some pdecl /\
ind_npars mdecl = p.1 .2
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_inductive
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
Ast.wf pdecl.2
assert (wfpars := on_inductive_wf_params prf).cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind p.1 .1 ) =
Some idecl
Hpdecl : nth_error (ind_projs idecl) p.2 = Some pdecl /\
ind_npars mdecl = p.1 .2
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_inductive
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
wfpars : Forall wf_decl (ind_params mdecl)
Ast.wf pdecl.2
apply onInductives in prf.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
Hidecl : nth_error (ind_bodies mdecl)
(inductive_ind p.1 .1 ) =
Some idecl
Hpdecl : nth_error (ind_projs idecl) p.2 = Some pdecl /\
ind_npars mdecl = p.1 .2
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Ast.wf pdecl.2
eapply nth_error_alli in Hidecl; eauto .cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
Hpdecl : nth_error (ind_projs idecl) p.2 = Some pdecl /\
ind_npars mdecl = p.1 .2
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
Ast.wf pdecl.2
intuition auto .cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
Ast.wf pdecl.2
pose proof (onProjections Hidecl) as on_projs.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
on_projs : ind_projs idecl <> [] ->
match ind_ctors idecl with
| [] => False
| [o] =>
on_projections mdecl
(inductive_mind p.1 .1 )
(0 + inductive_ind p.1 .1 ) idecl
(ind_indices idecl) o
| o :: _ :: _ => False
end
Ast.wf pdecl.2
forward on_projs by now eapply nth_error_Some_non_nil in H. cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
on_projs : match ind_ctors idecl with
| [] => False
| [o] =>
on_projections mdecl
(inductive_mind p.1 .1 )
(0 + inductive_ind p.1 .1 ) idecl
(ind_indices idecl) o
| o :: _ :: _ => False
end
Ast.wf pdecl.2
destruct (ind_ctors idecl) as [|? [|]] eqn :Heq; try contradiction .cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs : on_projections mdecl (inductive_mind p.1 .1 )
(0 + inductive_ind p.1 .1 ) idecl
(ind_indices idecl) c
Ast.wf pdecl.2
destruct on_projs.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
on_projs : Alli
(on_projection mdecl
(inductive_mind p.1 .1 )
(0 + inductive_ind p.1 .1 ) c) 0
(ind_projs idecl)
Ast.wf pdecl.2
eapply nth_error_alli in on_projs; eauto .cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
on_projs : on_projection mdecl (inductive_mind p.1 .1 )
(0 + inductive_ind p.1 .1 ) c
(0 + p.2 ) pdecl
Ast.wf pdecl.2
red in on_projs.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
on_projs : match
nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) -
S (0 + p.2 ))
with
| Some decl =>
binder_name (decl_name decl) =
nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := 0 +
inductive_ind p.1 .1 |}
(ind_npars mdecl)
(0 + p.2 ))
(lift 1 (0 + p.2 ) (decl_type decl)))
| None => False
end
Ast.wf pdecl.2
hnf in on_projs.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
on_projs : match
nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) -
S (0 + p.2 ))
with
| Some decl =>
binder_name (decl_name decl) =
nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := 0 +
inductive_ind p.1 .1 |}
(ind_npars mdecl)
(0 + p.2 ))
(lift 1 (0 + p.2 ) (decl_type decl)))
| None => False
end
Ast.wf pdecl.2
simpl in on_projs.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
on_projs : match
nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) -
S p.2 )
with
| Some decl =>
binder_name (decl_name decl) =
nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type decl)))
| None => False
end
Ast.wf pdecl.2
destruct (nth_error (smash_context _ _) _) eqn :Heq'; try contradiction .cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
on_projs : binder_name (decl_name c0) = nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
Ast.wf pdecl.2
pose proof (declared_inductive_wf_ctors' Hidecl).cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
on_projs : binder_name (decl_name c0) = nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H1 : Forall
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs))
(ind_ctors idecl)
Ast.wf pdecl.2
eapply Forall_All in H1.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
on_projs : binder_name (decl_name c0) = nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H1 : All
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs))
(ind_ctors idecl)
Ast.wf pdecl.2
simpl in Heq.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
on_projs : binder_name (decl_name c0) = nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H1 : All
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs))
(ind_ctors idecl)
Ast.wf pdecl.2
rewrite Heq in H1.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
on_projs : binder_name (decl_name c0) = nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H1 : All
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs)) [c]
Ast.wf pdecl.2
inv H1. cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
on_projs : binder_name (decl_name c0) = nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
X0 : All
(fun cs : constructor_body =>
Forall wf_decl (cstr_args cs)) []
Ast.wf pdecl.2
clear X0.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
on_projs : binder_name (decl_name c0) = nNamed pdecl.1 /\
pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
Ast.wf pdecl.2
destruct on_projs as [onna on_projs].cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
Ast.wf pdecl.2
rewrite on_projs.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
Ast.wf
(subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind p.1 .1 ;
inductive_ind := inductive_ind p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0))))
eapply wf_subst.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
Forall Ast.wf
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
eapply wf_inds.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
Ast.wf
(subst0
(projs
{|
inductive_mind := inductive_mind p.1 .1 ;
inductive_ind := inductive_ind p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
eapply wf_subst.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
Forall Ast.wf
(projs
{|
inductive_mind := inductive_mind p.1 .1 ;
inductive_ind := inductive_ind p.1 .1 |}
(ind_npars mdecl) p.2 )
eapply wf_projs.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
Ast.wf (lift 1 p.2 (decl_type c0))
eapply wf_lift.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
wfpars : Forall wf_decl (ind_params mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
Ast.wf (decl_type c0)
eapply app_Forall in wfpars; [|eapply H2].cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
wfpars : Forall wf_decl
(cstr_args c ++ ind_params mdecl)
Ast.wf (decl_type c0)
eapply (wf_smash_context _ []) in wfpars.cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
wfpars : Forall wf_decl
(smash_context []
(cstr_args c ++ ind_params mdecl))
Ast.wf (decl_type c0)
2 :constructor .cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
Heq' : nth_error
(smash_context []
(cstr_args c ++ ind_params mdecl))
(context_assumptions (cstr_args c) - S p.2 ) =
Some c0
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
wfpars : Forall wf_decl
(smash_context []
(cstr_args c ++ ind_params mdecl))
Ast.wf (decl_type c0)
eapply nth_error_forall in Heq'; eauto .cf : checker_flags
Σ : global_env
p : projection
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : Alli
(on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context )
(t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl) 0
(ind_bodies mdecl)
Hidecl : on_ind_body
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
(inductive_mind p.1 .1 ) mdecl
(0 + inductive_ind p.1 .1 ) idecl
H : nth_error (ind_projs idecl) p.2 = Some pdecl
H0 : ind_npars mdecl = p.1 .2
c : constructor_body
Heq : ind_ctors idecl = [c]
on_projs_record : #|ind_ctors idecl| = 1
on_projs_noidx : #|ind_indices idecl| = 0
on_projs_elim : ind_kelim idecl = IntoAny
on_projs_all : #|ind_projs idecl| =
context_assumptions (cstr_args c)
c0 : context_decl
onna : binder_name (decl_name c0) = nNamed pdecl.1
on_projs : pdecl.2 =
subst
(inds (inductive_mind p.1 .1 )
(TemplateLookup.abstract_instance
(ind_universes mdecl))
(ind_bodies mdecl))
(S (ind_npars mdecl))
(subst0
(projs
{|
inductive_mind := inductive_mind
p.1 .1 ;
inductive_ind := inductive_ind
p.1 .1 |}
(ind_npars mdecl) p.2 )
(lift 1 p.2 (decl_type c0)))
H2 : Forall wf_decl (cstr_args c)
wfpars : Forall wf_decl
(smash_context []
(cstr_args c ++ ind_params mdecl))
Heq' : wf_decl c0
Ast.wf (decl_type c0)
apply Heq'.
Qed .
(* TODO MOVE *)
Definition on_option {A } (P : A -> Prop ) (o : option A) :=
match o with
| Some x => P x
| None => True
end .
Lemma declared_constant_wf {cf :checker_flags} :
forall Σ cst decl ,
Forall_decls_typing (fun (_ : global_env_ext) (_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T
) Σ ->
declared_constant Σ cst decl ->
Ast.wf decl.(cst_type) /\
on_option Ast.wf decl.(cst_body).forall (Σ : global_env) (cst : kername)
(decl : constant_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_constant Σ cst decl ->
Ast.wf (cst_type decl) /\
on_option Ast.wf (cst_body decl)
Proof .forall (Σ : global_env) (cst : kername)
(decl : constant_body),
Forall_decls_typing
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T) Σ ->
declared_constant Σ cst decl ->
Ast.wf (cst_type decl) /\
on_option Ast.wf (cst_body decl)
intros Σ cst decl wΣ h.cf : checker_flags
Σ : global_env
cst : kername
decl : constant_body
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
h : declared_constant Σ cst decl
Ast.wf (cst_type decl) /\
on_option Ast.wf (cst_body decl)
unfold declared_constant in h.cf : checker_flags
Σ : global_env
cst : kername
decl : constant_body
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
h : lookup_env Σ cst = Some (ConstantDecl decl)
Ast.wf (cst_type decl) /\
on_option Ast.wf (cst_body decl)
eapply lookup_on_global_env in h as [Σ' [wΣ' h']].cf : checker_flags
Σ : global_env
cst : kername
decl : constant_body
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wΣ' : on_global_env ?P Σ'.1
h' : on_global_decl ?P Σ' cst (ConstantDecl decl)
Ast.wf (cst_type decl) /\
on_option Ast.wf (cst_body decl)
2 : eassumption .cf : checker_flags
Σ : global_env
cst : kername
decl : constant_body
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
h' : on_global_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' cst
(ConstantDecl decl)
Ast.wf (cst_type decl) /\
on_option Ast.wf (cst_body decl)
simpl in h'.cf : checker_flags
Σ : global_env
cst : kername
decl : constant_body
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
h' : on_constant_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' decl
Ast.wf (cst_type decl) /\
on_option Ast.wf (cst_body decl)
destruct decl as [ty [bo|]].cf : checker_flags
Σ : global_env
cst : kername
ty, bo : term
cst_universes0 : universes_decl
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
h' : on_constant_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'
{|
cst_type := ty;
cst_body := Some bo;
cst_universes := cst_universes0 |}
Ast.wf
(cst_type
{|
cst_type := ty;
cst_body := Some bo;
cst_universes := cst_universes0 |}) /\
on_option Ast.wf
(cst_body
{|
cst_type := ty;
cst_body := Some bo;
cst_universes := cst_universes0 |})
all : cbn in *.cf : checker_flags
Σ : global_env
cst : kername
ty, bo : term
cst_universes0 : universes_decl
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
h' : Ast.wf bo /\ Ast.wf ty
Ast.wf ty /\ Ast.wf bo
- cf : checker_flags
Σ : global_env
cst : kername
ty, bo : term
cst_universes0 : universes_decl
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
h' : Ast.wf bo /\ Ast.wf ty
Ast.wf ty /\ Ast.wf bo
intuition eauto .
- cf : checker_flags
Σ : global_env
cst : kername
ty : term
cst_universes0 : universes_decl
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
h' : ∑ s : Universe .t, Ast.wf ty /\ Ast.wf (tSort s)
Ast.wf ty /\ True
destruct h'.cf : checker_flags
Σ : global_env
cst : kername
ty : term
cst_universes0 : universes_decl
wΣ : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ
Σ' : global_env * universes_decl
wΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
x : Universe .t
a : Ast.wf ty /\ Ast.wf (tSort x)
Ast.wf ty /\ True
intuition eauto .
Qed .
Lemma wf_it_mkProd_or_LetIn `{checker_flags} Σ Γ (wfΓ : wf_local Σ Γ)
: All_local_env_over typing
(fun (Σ : global_env_ext) (Γ : context ) (_ : wf_local Σ Γ)
(t T : term) (_ : Σ;;; Γ |- t : T) => Ast.wf t /\ Ast.wf T) Σ
Γ wfΓ
-> forall t , Ast.wf t -> Ast.wf (it_mkProd_or_LetIn Γ t).H : checker_flags
Σ : global_env_ext
Γ : context
wfΓ : wf_local Σ Γ
All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t T : term)
(_ : Σ0;;; Γ0 |- t : T) => Ast.wf t /\ Ast.wf T)
Σ Γ wfΓ ->
forall t : term,
Ast.wf t -> Ast.wf (it_mkProd_or_LetIn Γ t)
Proof .H : checker_flags
Σ : global_env_ext
Γ : context
wfΓ : wf_local Σ Γ
All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t T : term)
(_ : Σ0;;; Γ0 |- t : T) => Ast.wf t /\ Ast.wf T)
Σ Γ wfΓ ->
forall t : term,
Ast.wf t -> Ast.wf (it_mkProd_or_LetIn Γ t)
induction 1 ; simpl .H : checker_flags
Σ : global_env_ext
forall t : term, Ast.wf t -> Ast.wf t
- H : checker_flags
Σ : global_env_ext
forall t : term, Ast.wf t -> Ast.wf t
trivial .
- H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
t : term
all : wf_local Σ Γ
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t0 T : term)
(_ : Σ0;;; Γ0 |- t0 : T) =>
Ast.wf t0 /\ Ast.wf T) Σ Γ all
tu : lift_typing typing Σ Γ t None
p : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ t0)
forall t0 : term,
Ast.wf t0 ->
Ast.wf
(it_mkProd_or_LetIn Γ
(mkProd_or_LetIn (vass na t) t0))
intros t0 Ht0.H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
t : term
all : wf_local Σ Γ
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t1 T : term)
(_ : Σ0;;; Γ0 |- t1 : T) =>
Ast.wf t1 /\ Ast.wf T) Σ Γ all
tu : lift_typing typing Σ Γ t None
p : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0 : term
Ht0 : Ast.wf t0
Ast.wf
(it_mkProd_or_LetIn Γ
(mkProd_or_LetIn (vass na t) t0))
apply IHX.H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
t : term
all : wf_local Σ Γ
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t1 T : term)
(_ : Σ0;;; Γ0 |- t1 : T) =>
Ast.wf t1 /\ Ast.wf T) Σ Γ all
tu : lift_typing typing Σ Γ t None
p : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0 : term
Ht0 : Ast.wf t0
Ast.wf (mkProd_or_LetIn (vass na t) t0)
constructor .H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
t : term
all : wf_local Σ Γ
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t1 T : term)
(_ : Σ0;;; Γ0 |- t1 : T) =>
Ast.wf t1 /\ Ast.wf T) Σ Γ all
tu : lift_typing typing Σ Γ t None
p : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0 : term
Ht0 : Ast.wf t0
Ast.wf (decl_type (vass na t))
apply p.H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
t : term
all : wf_local Σ Γ
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t1 T : term)
(_ : Σ0;;; Γ0 |- t1 : T) =>
Ast.wf t1 /\ Ast.wf T) Σ Γ all
tu : lift_typing typing Σ Γ t None
p : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0 : term
Ht0 : Ast.wf t0
Ast.wf t0
assumption .
- H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
b, t : term
all : wf_local Σ Γ
tb : Σ;;; Γ |- b : t
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t0 T : term)
(_ : Σ0;;; Γ0 |- t0 : T) =>
Ast.wf t0 /\ Ast.wf T) Σ Γ all
p : Ast.wf b /\ Ast.wf t
tu : lift_typing typing Σ Γ t None
p0 : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ t0)
forall t0 : term,
Ast.wf t0 ->
Ast.wf
(it_mkProd_or_LetIn Γ
(mkProd_or_LetIn (vdef na b t) t0))
intros t0 Ht0.H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
b, t : term
all : wf_local Σ Γ
tb : Σ;;; Γ |- b : t
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t1 T : term)
(_ : Σ0;;; Γ0 |- t1 : T) =>
Ast.wf t1 /\ Ast.wf T) Σ Γ all
p : Ast.wf b /\ Ast.wf t
tu : lift_typing typing Σ Γ t None
p0 : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0 : term
Ht0 : Ast.wf t0
Ast.wf
(it_mkProd_or_LetIn Γ
(mkProd_or_LetIn (vdef na b t) t0))
apply IHX.H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
b, t : term
all : wf_local Σ Γ
tb : Σ;;; Γ |- b : t
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t1 T : term)
(_ : Σ0;;; Γ0 |- t1 : T) =>
Ast.wf t1 /\ Ast.wf T) Σ Γ all
p : Ast.wf b /\ Ast.wf t
tu : lift_typing typing Σ Γ t None
p0 : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0 : term
Ht0 : Ast.wf t0
Ast.wf (mkProd_or_LetIn (vdef na b t) t0)
constructor .H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
b, t : term
all : wf_local Σ Γ
tb : Σ;;; Γ |- b : t
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t1 T : term)
(_ : Σ0;;; Γ0 |- t1 : T) =>
Ast.wf t1 /\ Ast.wf T) Σ Γ all
p : Ast.wf b /\ Ast.wf t
tu : lift_typing typing Σ Γ t None
p0 : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0 : term
Ht0 : Ast.wf t0
Ast.wf b
apply p.H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
b, t : term
all : wf_local Σ Γ
tb : Σ;;; Γ |- b : t
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t1 T : term)
(_ : Σ0;;; Γ0 |- t1 : T) =>
Ast.wf t1 /\ Ast.wf T) Σ Γ all
p : Ast.wf b /\ Ast.wf t
tu : lift_typing typing Σ Γ t None
p0 : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0 : term
Ht0 : Ast.wf t0
Ast.wf (decl_type (vdef na b t))
apply p.H : checker_flags
Σ : global_env_ext
Γ : context
na : aname
b, t : term
all : wf_local Σ Γ
tb : Σ;;; Γ |- b : t
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t1 T : term)
(_ : Σ0;;; Γ0 |- t1 : T) =>
Ast.wf t1 /\ Ast.wf T) Σ Γ all
p : Ast.wf b /\ Ast.wf t
tu : lift_typing typing Σ Γ t None
p0 : Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX : forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0 : term
Ht0 : Ast.wf t0
Ast.wf t0
assumption .
Qed .
Lemma wf_Lambda_or_LetIn {d t } :
wf_decl d ->
Ast.wf t ->
Ast.wf (mkLambda_or_LetIn d t).wf_decl d ->
Ast.wf t -> Ast.wf (mkLambda_or_LetIn d t)
Proof .wf_decl d ->
Ast.wf t -> Ast.wf (mkLambda_or_LetIn d t)
destruct d as [? [|] ?]; simpl ; wf ;
unfold wf_decl, mkLambda_or_LetIn in *; simpl in *.decl_name : aname
t0, decl_type, t : term
H : Ast.wf t0 /\ Ast.wf decl_type
H0 : Ast.wf t
Ast.wf (tLetIn decl_name t0 decl_type t)
constructor ; intuition auto .decl_name : aname
decl_type, t : term
H : True /\ Ast.wf decl_type
H0 : Ast.wf t
Ast.wf (tLambda decl_name decl_type t)
constructor ; intuition auto .
Qed .
Lemma wf_it_mkLambda_or_LetIn {Γ t } :
Forall wf_decl Γ ->
Ast.wf t ->
Ast.wf (it_mkLambda_or_LetIn Γ t).Γ : list context_decl
t : term
Forall wf_decl Γ ->
Ast.wf t -> Ast.wf (it_mkLambda_or_LetIn Γ t)
Proof .Γ : list context_decl
t : term
Forall wf_decl Γ ->
Ast.wf t -> Ast.wf (it_mkLambda_or_LetIn Γ t)
intros wfΓ wft; induction wfΓ in t, wft |- *; simpl .
- trivial .
- t : term
x : context_decl
l : list context_decl
H : wf_decl x
wfΓ : Forall wf_decl l
wft : Ast.wf t
IHwfΓ : forall t0 : term,
Ast.wf t0 ->
Ast.wf (it_mkLambda_or_LetIn l t0)
Ast.wf
(it_mkLambda_or_LetIn l (mkLambda_or_LetIn x t))
apply IHwfΓ.t : term
x : context_decl
l : list context_decl
H : wf_decl x
wfΓ : Forall wf_decl l
wft : Ast.wf t
IHwfΓ : forall t0 : term,
Ast.wf t0 ->
Ast.wf (it_mkLambda_or_LetIn l t0)
Ast.wf (mkLambda_or_LetIn x t)
now apply wf_Lambda_or_LetIn.
Qed .
Lemma typing_wf_gen {cf :checker_flags} :
env_prop
(fun Σ Γ t T => Ast.wf t /\ Ast.wf T)
(fun Σ Γ wfΓ => Forall wf_decl Γ).env_prop
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T)
(fun (Σ : global_env_ext) (Γ : context )
(_ : wf_local Σ Γ) => Forall wf_decl Γ)
Proof .env_prop
(fun (_ : global_env_ext) (_ : context ) (t T : term)
=> Ast.wf t /\ Ast.wf T)
(fun (Σ : global_env_ext) (Γ : context )
(_ : wf_local Σ Γ) => Forall wf_decl Γ)
apply typing_ind_env; intros ; auto with wf ;
specialize_goal;
try solve [split ; try constructor ; intuition auto with wf ].cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
X : All_local_env_over typing
(fun (Σ0 : global_env_ext) (Γ0 : context )
(_ : wf_local Σ0 Γ0) (t T : term)
(_ : Σ0;;; Γ0 |- t : T) =>
Ast.wf t /\ Ast.wf T) Σ Γ wfΓ
Forall wf_decl Γ
- cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
X : All_local_env_over typing
(fun (Σ0 : global_env_ext)
(Γ0 : context ) (_ : wf_local Σ0 Γ0)
(t T : term) (_ : Σ0;;; Γ0 |- t : T) =>
Ast.wf t /\ Ast.wf T) Σ Γ wfΓ
Forall wf_decl Γ
eapply All_local_env_wf_decls.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
X : All_local_env_over typing
(fun (Σ0 : global_env_ext)
(Γ0 : context ) (_ : wf_local Σ0 Γ0)
(t T : term) (_ : Σ0;;; Γ0 |- t : T) =>
Ast.wf t /\ Ast.wf T) Σ Γ wfΓ
TemplateEnvTyping.All_local_env wf_decl_pred Γ
induction X; constructor ; auto ; red ; intuition auto .
- cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
n : nat
decl : context_decl
H : nth_error Γ n = Some decl
H0 : Forall wf_decl Γ
Ast.wf (tRel n) /\
Ast.wf (lift0 (S n) (decl_type decl))
split ; wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
n : nat
decl : context_decl
H : nth_error Γ n = Some decl
H0 : Forall wf_decl Γ
Ast.wf (lift0 (S n) (decl_type decl))
apply wf_lift.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
n : nat
decl : context_decl
H : nth_error Γ n = Some decl
H0 : Forall wf_decl Γ
Ast.wf (decl_type decl)
pose proof (nth_error_forall H H0) as XX.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
n : nat
decl : context_decl
H : nth_error Γ n = Some decl
H0 : Forall wf_decl Γ
XX : wf_decl decl
Ast.wf (decl_type decl)
apply XX.
- cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t : term
l : list term
t_ty, t' : term
X : Σ;;; Γ |- t : t_ty
H : Ast.wf t /\ Ast.wf t_ty
H0 : isApp t = false
H1 : l <> []
s : typing_spine Σ Γ t_ty l t'
X0 : Forall_typing_spine Σ Γ
(fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty
l t' s
Ast.wf (tApp t l) /\ Ast.wf t'
split .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t : term
l : list term
t_ty, t' : term
X : Σ;;; Γ |- t : t_ty
H : Ast.wf t /\ Ast.wf t_ty
H0 : isApp t = false
H1 : l <> []
s : typing_spine Σ Γ t_ty l t'
X0 : Forall_typing_spine Σ Γ
(fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty
l t' s
Ast.wf (tApp t l)
constructor ; auto .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t : term
l : list term
t_ty, t' : term
X : Σ;;; Γ |- t : t_ty
H : Ast.wf t /\ Ast.wf t_ty
H0 : isApp t = false
H1 : l <> []
s : typing_spine Σ Γ t_ty l t'
X0 : Forall_typing_spine Σ Γ
(fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty
l t' s
Ast.wf t
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t : term
l : list term
t_ty, t' : term
X : Σ;;; Γ |- t : t_ty
H : Ast.wf t /\ Ast.wf t_ty
H0 : isApp t = false
H1 : l <> []
s : typing_spine Σ Γ t_ty l t'
X0 : Forall_typing_spine Σ Γ
(fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty
l t' s
Forall Ast.wf l
clear H0 H1 X.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t : term
l : list term
t_ty, t' : term
H : Ast.wf t /\ Ast.wf t_ty
s : typing_spine Σ Γ t_ty l t'
X0 : Forall_typing_spine Σ Γ
(fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty
l t' s
Forall Ast.wf l
induction X0.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
Forall Ast.wf []
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) ->
Forall Ast.wf tl
Forall Ast.wf (hd :: tl)
constructor .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) ->
Forall Ast.wf tl
Ast.wf hd
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) ->
Forall Ast.wf tl
Forall Ast.wf tl
apply IHX0.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) ->
Forall Ast.wf tl
Ast.wf t /\ Ast.wf (B {0 := hd})
split .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) ->
Forall Ast.wf tl
Ast.wf t
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) ->
Forall Ast.wf tl
Ast.wf (B {0 := hd})
apply wf_subst.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) ->
Forall Ast.wf tl
Forall Ast.wf [hd]
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) ->
Forall Ast.wf tl
Ast.wf B
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T, hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
H0 : Ast.wf t
H1 : Ast.wf T
H : Ast.wf (tProd na A B)
H2 : Ast.wf (tSort s)
H3 : Ast.wf hd
H4 : Ast.wf A
H6 : Ast.wf (B {0 := hd}) -> Forall Ast.wf tl
Ast.wf B
now inv H.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t : term
l : list term
t_ty, t' : term
X : Σ;;; Γ |- t : t_ty
H : Ast.wf t /\ Ast.wf t_ty
H0 : isApp t = false
H1 : l <> []
s : typing_spine Σ Γ t_ty l t'
X0 : Forall_typing_spine Σ Γ
(fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty
l t' s
Ast.wf t'
clear H0 H1 X.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t : term
l : list term
t_ty, t' : term
H : Ast.wf t /\ Ast.wf t_ty
s : typing_spine Σ Γ t_ty l t'
X0 : Forall_typing_spine Σ Γ
(fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty
l t' s
Ast.wf t'
induction X0.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
Ast.wf T
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'
Ast.wf B'
apply IHX0.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'
Ast.wf t /\ Ast.wf (B {0 := hd})
constructor .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'
Ast.wf t
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'
Ast.wf (B {0 := hd})
apply wf_subst.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'
Forall Ast.wf [hd]
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T : term
H : Ast.wf t /\ Ast.wf T
hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
p : Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0 : Ast.wf hd /\ Ast.wf A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
IHX0 : Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'
Ast.wf B
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
t, T, hd : term
tl : list term
na : aname
A, B : term
s : Universe .t
B' : term
tls : typing_spine Σ Γ (B {0 := hd}) tl B'
typrod : Σ;;; Γ |- tProd na A B : tSort s
cumul : Σ;;; Γ |- T <= tProd na A B
ty : Σ;;; Γ |- hd : A
X0 : Forall_typing_spine Σ Γ
(fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0)
(B {0 := hd}) tl B' tls
H0 : Ast.wf t
H1 : Ast.wf T
H : Ast.wf (tProd na A B)
H2 : Ast.wf (tSort s)
H3 : Ast.wf hd
H4 : Ast.wf A
H6 : Ast.wf (B {0 := hd}) -> Ast.wf B'
Ast.wf B
now inv H.
- cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
cst : kername
u : Instance .t
decl : constant_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : declared_constant Σ.1 cst decl
H1 : consistent_instance_ext Σ (cst_universes decl) u
Ast.wf (tConst cst u) /\
Ast.wf (subst_instance u (cst_type decl))
split .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
cst : kername
u : Instance .t
decl : constant_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : declared_constant Σ.1 cst decl
H1 : consistent_instance_ext Σ (cst_universes decl) u
Ast.wf (tConst cst u)
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
cst : kername
u : Instance .t
decl : constant_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : declared_constant Σ.1 cst decl
H1 : consistent_instance_ext Σ (cst_universes decl) u
Ast.wf (subst_instance u (cst_type decl))
apply wf_subst_instance.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
cst : kername
u : Instance .t
decl : constant_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : declared_constant Σ.1 cst decl
H1 : consistent_instance_ext Σ (cst_universes decl) u
Ast.wf (cst_type decl)
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
cst : kername
u : Instance .t
decl : constant_body
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : declared_constant Σ.1 cst decl
H1 : consistent_instance_ext Σ (cst_universes decl) u
Ast.wf (cst_type decl)
eapply lookup_on_global_env in X as [Σ' [wfΣ' prf]]; eauto .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
cst : kername
u : Instance .t
decl : constant_body
H : Forall wf_decl Γ
H0 : declared_constant Σ.1 cst decl
H1 : consistent_instance_ext Σ (cst_universes decl) u
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_global_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' cst
(ConstantDecl decl)
Ast.wf (cst_type decl)
red in prf.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
cst : kername
u : Instance .t
decl : constant_body
H : Forall wf_decl Γ
H0 : declared_constant Σ.1 cst decl
H1 : consistent_instance_ext Σ (cst_universes decl) u
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_constant_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' decl
Ast.wf (cst_type decl)
destruct decl; destruct cst_body0; red in prf; simpl in *; wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
cst : kername
u : Instance .t
cst_type0 : term
cst_universes0 : universes_decl
H : Forall wf_decl Γ
H0 : declared_constant Σ.1 cst
{|
cst_type := cst_type0;
cst_body := None;
cst_universes := cst_universes0 |}
H1 : consistent_instance_ext Σ cst_universes0 u
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
prf : on_type
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ' [] cst_type0
Ast.wf cst_type0
destruct prf.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
cst : kername
u : Instance .t
cst_type0 : term
cst_universes0 : universes_decl
H : Forall wf_decl Γ
H0 : declared_constant Σ.1 cst
{|
cst_type := cst_type0;
cst_body := None;
cst_universes := cst_universes0 |}
H1 : consistent_instance_ext Σ cst_universes0 u
Σ' : global_env * universes_decl
wfΣ' : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) Σ'.1
x : Universe .t
a : Ast.wf cst_type0 /\ Ast.wf (tSort x)
Ast.wf cst_type0
apply a.
- cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 ind mdecl idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (tInd ind u) /\
Ast.wf (subst_instance u (ind_type idecl))
split .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 ind mdecl idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (tInd ind u)
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 ind mdecl idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (subst_instance u (ind_type idecl))
apply wf_subst_instance.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 ind mdecl idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (ind_type idecl)
eapply declared_inductive_wf; eauto .
- cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
i : nat
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
isdecl : declared_constructor Σ.1
(ind, i) mdecl idecl cdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (tConstruct ind i u) /\
Ast.wf (type_of_constructor mdecl cdecl (ind, i) u)
split .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
i : nat
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
isdecl : declared_constructor Σ.1
(ind, i) mdecl idecl cdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (tConstruct ind i u)
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
i : nat
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
isdecl : declared_constructor Σ.1
(ind, i) mdecl idecl cdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (type_of_constructor mdecl cdecl (ind, i) u)
unfold type_of_constructor.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
i : nat
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
isdecl : declared_constructor Σ.1
(ind, i) mdecl idecl cdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf
(subst0
(inds (inductive_mind (ind, i).1 ) u
(ind_bodies mdecl))
(subst_instance u (cstr_type cdecl)))
apply wf_subst; auto with wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
i : nat
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
isdecl : declared_constructor Σ.1
(ind, i) mdecl idecl cdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (subst_instance u (cstr_type cdecl))
apply wf_subst_instance.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
ind : inductive
i : nat
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
cdecl : constructor_body
isdecl : declared_constructor Σ.1
(ind, i) mdecl idecl cdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (cstr_type cdecl)
eapply declared_constructor_wf; eauto .
- cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
H3 : Ast.wf (preturn p) /\ Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
H6 : Ast.wf c /\
Ast.wf
(mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices))
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
Ast.wf (tCase ci p c brs) /\
Ast.wf (mkApps ptm (indices ++ [c]))
destruct H3 as [wfret wps].cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
H6 : Ast.wf c /\
Ast.wf
(mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices))
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
Ast.wf (tCase ci p c brs) /\
Ast.wf (mkApps ptm (indices ++ [c]))
destruct H6 as [wfc wfapps].cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
wfapps : Ast.wf
(mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices))
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
Ast.wf (tCase ci p c brs) /\
Ast.wf (mkApps ptm (indices ++ [c]))
eapply wf_mkApps_inv in wfapps.cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
wfapps : Forall Ast.wf (pparams p ++ indices)
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
Ast.wf (tCase ci p c brs) /\
Ast.wf (mkApps ptm (indices ++ [c]))
eapply Forall_app in wfapps as [wfp wfindices].cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
wfp : Forall Ast.wf (pparams p)
wfindices : Forall Ast.wf indices
Ast.wf (tCase ci p c brs) /\
Ast.wf (mkApps ptm (indices ++ [c]))
assert (Forall wf_decl predctx).cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
wfp : Forall Ast.wf (pparams p)
wfindices : Forall Ast.wf indices
Forall wf_decl predctx
{ cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
wfp : Forall Ast.wf (pparams p)
wfindices : Forall Ast.wf indices
Forall wf_decl predctx
now apply Forall_app in H4 as [? ?]. } cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
wfp : Forall Ast.wf (pparams p)
wfindices : Forall Ast.wf indices
H3 : Forall wf_decl predctx
Ast.wf (tCase ci p c brs) /\
Ast.wf (mkApps ptm (indices ++ [c]))
split ; [constructor ; simpl ; auto ; solve_all|].cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
wfp : Forall Ast.wf (pparams p)
wfindices : Forall Ast.wf indices
H3 : Forall wf_decl predctx
Ast.wf (mkApps ptm (indices ++ [c]))
apply wf_mkApps.cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
wfp : Forall Ast.wf (pparams p)
wfindices : Forall Ast.wf indices
H3 : Forall wf_decl predctx
Ast.wf ptm
subst ptm.cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
H7 : isCoFinite (ind_finite mdecl) = false
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p
(it_mkLambda_or_LetIn predctx (preturn p)))
wfp : Forall Ast.wf (pparams p)
wfindices : Forall Ast.wf indices
H3 : Forall wf_decl predctx
Ast.wf (it_mkLambda_or_LetIn predctx (preturn p))
wf .cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
H7 : isCoFinite (ind_finite mdecl) = false
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p
(it_mkLambda_or_LetIn predctx (preturn p)))
wfp : Forall Ast.wf (pparams p)
wfindices : Forall Ast.wf indices
H3 : Forall wf_decl predctx
Ast.wf (it_mkLambda_or_LetIn predctx (preturn p))
apply wf_it_mkLambda_or_LetIn; auto .cf : checker_flags
Σ : global_env_ext
wfΣ : wf Σ
Γ : context
wfΓ : wf_local Σ Γ
ci : case_info
p : predicate term
c : term
brs : list (branch term)
indices : list term
ps : Universe .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
isdecl : declared_inductive Σ.1 (ci_ind ci) mdecl
idecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
H0 : ind_npars mdecl = ci_npar ci
H1 : #|ind_indices idecl| = #|pcontext p|
H2 : context_assumptions (ind_indices idecl) =
#|pparams p|
predctx := case_predicate_context (ci_ind ci) mdecl
idecl (pparams p) (puinst p)
(pcontext p) : context
pret : Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret : Ast.wf (preturn p)
wps : Ast.wf (tSort ps)
H4 : Forall wf_decl (Γ,,, predctx)
H5 : is_allowed_elimination Σ ps (ind_kelim idecl)
X0 : Σ;;; Γ |- c
: mkApps (tInd (ci_ind ci) (puinst p))
(pparams p ++ indices)
wfc : Ast.wf c
H7 : isCoFinite (ind_finite mdecl) = false
ptm := it_mkLambda_or_LetIn predctx (preturn p) : term
X1 : All2
(fun (br : branch term)
(brctxty : list context_decl × term) =>
(((Forall2
(fun (na : binder_annot name)
(decl : context_decl) =>
eq_binder_annot na (decl_name decl))
(bcontext br) brctxty.1
× Σ;;; Γ,,, brctxty.1 |-
bbody br : brctxty.2 )
× Ast.wf (bbody br) /\ Ast.wf brctxty.2 )
× Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) *
(Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs
(case_branches_types (ci_ind ci) idecl p ptm)
wfp : Forall Ast.wf (pparams p)
wfindices : Forall Ast.wf indices
H3 : Forall wf_decl predctx
Forall Ast.wf (indices ++ [c])
apply app_Forall; auto .
- cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H0 : Ast.wf c /\ Ast.wf (mkApps (tInd p.1 .1 u) args)
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
Ast.wf (tProj p c) /\
Ast.wf
(subst0 (c :: List.rev args) (subst_instance u ty))
split .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H0 : Ast.wf c /\ Ast.wf (mkApps (tInd p.1 .1 u) args)
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
Ast.wf (tProj p c)
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H0 : Ast.wf c /\ Ast.wf (mkApps (tInd p.1 .1 u) args)
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
Ast.wf
(subst0 (c :: List.rev args) (subst_instance u ty))
apply wf_subst.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H0 : Ast.wf c /\ Ast.wf (mkApps (tInd p.1 .1 u) args)
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
Forall Ast.wf (c :: List.rev args)
solve_all. cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : All wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
H2 : Ast.wf c
H3 : Ast.wf (mkApps (tInd p.1 .1 u) args)
All Ast.wf (c :: List.rev args)
constructor .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : All wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
H2 : Ast.wf c
H3 : Ast.wf (mkApps (tInd p.1 .1 u) args)
Ast.wf c
wf .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : All wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
H2 : Ast.wf c
H3 : Ast.wf (mkApps (tInd p.1 .1 u) args)
All Ast.wf (List.rev args)
apply wf_mkApps_inv in H3.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : All wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
H2 : Ast.wf c
H3 : Forall Ast.wf args
All Ast.wf (List.rev args)
apply All_rev.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : All wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
H2 : Ast.wf c
H3 : Forall Ast.wf args
All Ast.wf args
solve_all. cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H0 : Ast.wf c /\ Ast.wf (mkApps (tInd p.1 .1 u) args)
H1 : #|args| = ind_npars mdecl
ty := pdecl.2 : term
Ast.wf (subst_instance u ty)
subst ty.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : declared_projection Σ.1 p mdecl idecl pdecl
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H0 : Ast.wf c /\ Ast.wf (mkApps (tInd p.1 .1 u) args)
H1 : #|args| = ind_npars mdecl
Ast.wf (subst_instance u pdecl.2 )
eapply declared_projection_wf in isdecl; eauto .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
p : projection
c : term
u : Instance .t
mdecl : mutual_inductive_body
idecl : one_inductive_body
pdecl : ident * term
isdecl : Ast.wf pdecl.2
args : list term
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
H : Forall wf_decl Γ
X0 : Σ;;; Γ |- c : mkApps (tInd p.1 .1 u) args
H0 : Ast.wf c /\ Ast.wf (mkApps (tInd p.1 .1 u) args)
H1 : #|args| = ind_npars mdecl
Ast.wf (subst_instance u pdecl.2 )
now eapply wf_subst_instance.
- cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
types := fix_context mfix : context
H : is_true (fix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, types |- dbody d
: lift0 #|types| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|types| (dtype d)))) mfix
H2 : is_true (wf_fixpoint Σ.1 mfix)
Ast.wf (tFix mfix n) /\ Ast.wf (dtype decl)
subst types.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H : is_true (fix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_fixpoint Σ.1 mfix)
Ast.wf (tFix mfix n) /\ Ast.wf (dtype decl)
clear H.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_fixpoint Σ.1 mfix)
Ast.wf (tFix mfix n) /\ Ast.wf (dtype decl)
split .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_fixpoint Σ.1 mfix)
Ast.wf (tFix mfix n)
+ cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_fixpoint Σ.1 mfix)
Ast.wf (tFix mfix n)
constructor .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_fixpoint Σ.1 mfix)
Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
solve_all. cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H0 : nth_error mfix n = Some decl
H1 : All wf_decl Γ
H2 : is_true (wf_fixpoint Σ.1 mfix)
x : def term
a : ∑ s : Universe .t,
Σ;;; Γ |- dtype x : tSort s
× Ast.wf (dtype x) /\ Ast.wf (tSort s)
a0 : Σ;;; Γ,,, fix_context mfix |-
dbody x : lift0 #|fix_context mfix| (dtype x)
H : Ast.wf (dbody x)
H3 : Ast.wf (lift0 #|fix_context mfix| (dtype x))
Ast.wf (dtype x)
destruct a.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H0 : nth_error mfix n = Some decl
H1 : All wf_decl Γ
H2 : is_true (wf_fixpoint Σ.1 mfix)
x : def term
x0 : Universe .t
p : (Σ;;; Γ |- dtype x : tSort x0) *
(Ast.wf (dtype x) /\ Ast.wf (tSort x0))
a0 : Σ;;; Γ,,, fix_context mfix |-
dbody x : lift0 #|fix_context mfix| (dtype x)
H : Ast.wf (dbody x)
H3 : Ast.wf (lift0 #|fix_context mfix| (dtype x))
Ast.wf (dtype x)
intuition .
+ cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_fixpoint Σ.1 mfix)
Ast.wf (dtype decl)
eapply All_nth_error in X; eauto .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_fixpoint Σ.1 mfix)
X : ∑ s : Universe .t,
Σ;;; Γ |- dtype decl : tSort s
× Ast.wf (dtype decl) /\ Ast.wf (tSort s)
Ast.wf (dtype decl)
destruct X as [s ?]; intuition .
- cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
types := fix_context mfix : context
H : is_true (cofix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, types |- dbody d
: lift0 #|types| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|types| (dtype d)))) mfix
H2 : is_true (wf_cofixpoint Σ.1 mfix)
Ast.wf (tCoFix mfix n) /\ Ast.wf (dtype decl)
subst types.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H : is_true (cofix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_cofixpoint Σ.1 mfix)
Ast.wf (tCoFix mfix n) /\ Ast.wf (dtype decl)
split .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H : is_true (cofix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_cofixpoint Σ.1 mfix)
Ast.wf (tCoFix mfix n)
+ cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H : is_true (cofix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_cofixpoint Σ.1 mfix)
Ast.wf (tCoFix mfix n)
constructor .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H : is_true (cofix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_cofixpoint Σ.1 mfix)
Forall
(fun def : def term =>
Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
solve_all. cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H : is_true (cofix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : All wf_decl Γ
H2 : is_true (wf_cofixpoint Σ.1 mfix)
x : def term
a : ∑ s : Universe .t,
Σ;;; Γ |- dtype x : tSort s
× Ast.wf (dtype x) /\ Ast.wf (tSort s)
a0 : Σ;;; Γ,,, fix_context mfix |-
dbody x : lift0 #|fix_context mfix| (dtype x)
H3 : Ast.wf (dbody x)
H4 : Ast.wf (lift0 #|fix_context mfix| (dtype x))
Ast.wf (dtype x)
destruct a.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H : is_true (cofix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : All wf_decl Γ
H2 : is_true (wf_cofixpoint Σ.1 mfix)
x : def term
x0 : Universe .t
p : (Σ;;; Γ |- dtype x : tSort x0) *
(Ast.wf (dtype x) /\ Ast.wf (tSort x0))
a0 : Σ;;; Γ,,, fix_context mfix |-
dbody x : lift0 #|fix_context mfix| (dtype x)
H3 : Ast.wf (dbody x)
H4 : Ast.wf (lift0 #|fix_context mfix| (dtype x))
Ast.wf (dtype x)
intuition .
+ cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H : is_true (cofix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X : All
(fun d : def term =>
∑ s : Universe .t,
Σ;;; Γ |- dtype d : tSort s
× Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_cofixpoint Σ.1 mfix)
Ast.wf (dtype decl)
eapply All_nth_error in X; eauto .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
mfix : list (def term)
n : nat
decl : def term
H : is_true (cofix_guard Σ Γ mfix)
H0 : nth_error mfix n = Some decl
H1 : Forall wf_decl Γ
X0 : All
(fun d : def term =>
(Σ;;; Γ,,, fix_context mfix |-
dbody d : lift0 #|fix_context mfix| (dtype d)) *
(Ast.wf (dbody d) /\
Ast.wf (lift0 #|fix_context mfix| (dtype d))))
mfix
H2 : is_true (wf_cofixpoint Σ.1 mfix)
X : ∑ s : Universe .t,
Σ;;; Γ |- dtype decl : tSort s
× Ast.wf (dtype decl) /\ Ast.wf (tSort s)
Ast.wf (dtype decl)
destruct X as [s ?]; intuition .
Qed .
Lemma typing_all_wf_decl {cf :checker_flags} Σ (wfΣ : wf Σ.1 ) Γ (wfΓ : wf_local Σ Γ) :
Forall wf_decl Γ.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
Forall wf_decl Γ
Proof .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
wfΓ : wf_local Σ Γ
Forall wf_decl Γ
eapply (env_prop_wf_local typing_wf_gen); eauto .
Qed .
Hint Resolve typing_all_wf_decl : wf .
Lemma typing_wf_sigma {cf :checker_flags} Σ (wfΣ : wf Σ) :
on_global_env (fun _ => wf_decl_pred) Σ.cf : checker_flags
Σ : global_env
wfΣ : wf Σ
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ
Proof .cf : checker_flags
Σ : global_env
wfΣ : wf Σ
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ
intros .cf : checker_flags
Σ : global_env
wfΣ : wf Σ
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ
pose proof (env_prop_sigma typing_wf_gen _ wfΣ).cf : checker_flags
Σ : global_env
wfΣ : wf Σ
X : Forall_decls_typing
(fun (_ : global_env_ext) (_ : context )
(t T : term) => Ast.wf t /\ Ast.wf T) Σ
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ
red in X.cf : checker_flags
Σ : global_env
wfΣ : wf Σ
X : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext) (_ : context )
(t T : term) => Ast.wf t /\ Ast.wf T)) Σ
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ
unfold lift_typing in X.cf : checker_flags
Σ : global_env
wfΣ : wf Σ
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t /\ Ast.wf (tSort s)
end ) Σ
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ
do 2 red in wfΣ.cf : checker_flags
Σ : global_env
wfΣ : on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t /\ Ast.wf (tSort s)
end ) Σ
on_global_env (fun _ : global_env_ext => wf_decl_pred)
Σ
eapply on_global_env_impl; eauto ; simpl ; intros .cf : checker_flags
Σ : global_env
wfΣ : on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T0 : option term) =>
match T0 with
| Some T1 => Ast.wf t0 /\ Ast.wf T1
| None =>
∑ s : Universe .t,
Ast.wf t0 /\ Ast.wf (tSort s)
end ) Σ
Σ0 : global_env * universes_decl
Γ : context
t : term
T : option term
X0 : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T0 : option term) =>
match T0 with
| Some T1 => Ast.wf t0 /\ Ast.wf T1
| None =>
∑ s : Universe .t,
Ast.wf t0 /\ Ast.wf (tSort s)
end ) Σ0.1
X1 : match T with
| Some T0 => Ast.wf t /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t /\ Ast.wf (tSort s)
end
wf_decl_pred Γ t T
destruct T.cf : checker_flags
Σ : global_env
wfΣ : on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t1 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t1 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t1 /\ Ast.wf (tSort s)
end ) Σ
Σ0 : global_env * universes_decl
Γ : context
t, t0 : term
X0 : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t1 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t1 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t1 /\ Ast.wf (tSort s)
end ) Σ0.1
X1 : Ast.wf t /\ Ast.wf t0
wf_decl_pred Γ t (Some t0)
red .cf : checker_flags
Σ : global_env
wfΣ : on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t1 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t1 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t1 /\ Ast.wf (tSort s)
end ) Σ
Σ0 : global_env * universes_decl
Γ : context
t, t0 : term
X0 : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t1 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t1 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t1 /\ Ast.wf (tSort s)
end ) Σ0.1
X1 : Ast.wf t /\ Ast.wf t0
Ast.wf t /\ Ast.wf t0
apply X1.cf : checker_flags
Σ : global_env
wfΣ : on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t0 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t0 /\ Ast.wf (tSort s)
end ) Σ
Σ0 : global_env * universes_decl
Γ : context
t : term
X0 : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t0 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t0 /\ Ast.wf (tSort s)
end ) Σ0.1
X1 : ∑ s : Universe .t, Ast.wf t /\ Ast.wf (tSort s)
wf_decl_pred Γ t None
red .cf : checker_flags
Σ : global_env
wfΣ : on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t0 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t0 /\ Ast.wf (tSort s)
end ) Σ
Σ0 : global_env * universes_decl
Γ : context
t : term
X0 : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t0 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t0 /\ Ast.wf (tSort s)
end ) Σ0.1
X1 : ∑ s : Universe .t, Ast.wf t /\ Ast.wf (tSort s)
Ast.wf t /\ True
destruct X1 as [x [a wfs]].cf : checker_flags
Σ : global_env
wfΣ : on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t0 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t0 /\ Ast.wf (tSort s)
end ) Σ
Σ0 : global_env * universes_decl
Γ : context
t : term
X0 : on_global_env
(fun (_ : global_env_ext) (_ : context )
(t0 : term) (T : option term) =>
match T with
| Some T0 => Ast.wf t0 /\ Ast.wf T0
| None =>
∑ s : Universe .t,
Ast.wf t0 /\ Ast.wf (tSort s)
end ) Σ0.1
x : Universe .t
a : Ast.wf t
wfs : Ast.wf (tSort x)
Ast.wf t /\ True
split ; auto .
Qed .
Lemma typing_wf {cf :checker_flags} Σ (wfΣ : wf Σ.1 ) Γ t T :
Σ ;;; Γ |- t : T -> Ast.wf t /\ Ast.wf T.cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
t, T : term
Σ;;; Γ |- t : T -> Ast.wf t /\ Ast.wf T
Proof .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
t, T : term
Σ;;; Γ |- t : T -> Ast.wf t /\ Ast.wf T
intros .cf : checker_flags
Σ : global_env * universes_decl
wfΣ : wf Σ.1
Γ : context
t, T : term
X : Σ;;; Γ |- t : T
Ast.wf t /\ Ast.wf T
eapply typing_wf_gen in X; intuition eauto with wf .
Qed .
Lemma wf_instantiate_params_subst_term :
forall params args s t ctx t' ,
Ast.wf t ->
instantiate_params_subst params args s t = Some (ctx, t') ->
Ast.wf t'.forall (params : context ) (args s : list term)
(t : term) (ctx : list term) (t' : term),
Ast.wf t ->
instantiate_params_subst params args s t =
Some (ctx, t') -> Ast.wf t'
Proof .forall (params : context ) (args s : list term)
(t : term) (ctx : list term) (t' : term),
Ast.wf t ->
instantiate_params_subst params args s t =
Some (ctx, t') -> Ast.wf t'
intros params args s t ctx t' h e.params : context
args, s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : instantiate_params_subst params args s t =
Some (ctx, t')
Ast.wf t'
revert args s t ctx t' h e.forall (args s : list term)
(t : term) (ctx : list term)
(t' : term),
Ast.wf t ->
instantiate_params_subst params args s t =
Some (ctx, t') -> Ast.wf t'
induction params ; intros args s t ctx t' h e.args, s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : instantiate_params_subst [] args s t =
Some (ctx, t')
Ast.wf t'
- args, s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : instantiate_params_subst [] args s t =
Some (ctx, t')
Ast.wf t'
destruct args ; try discriminate .s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : instantiate_params_subst [] [] s t =
Some (ctx, t')
Ast.wf t'
cbn in e.s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : Some (s, t) = Some (ctx, t')
Ast.wf t'
inversion e.s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : Some (s, t) = Some (ctx, t')
H0 : s = ctx
H1 : t = t'
Ast.wf t'
subst .ctx : list term
t' : term
e : Some (ctx, t') = Some (ctx, t')
h : Ast.wf t'
Ast.wf t'
assumption .
- a : context_decl
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : instantiate_params_subst (a :: params) args s t =
Some (ctx, t')
Ast.wf t'
destruct a as [na [bo|] ty].na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : instantiate_params_subst
({|
decl_name := na;
decl_body := Some bo;
decl_type := ty |} :: params) args s t =
Some (ctx, t')
Ast.wf t'
+ na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : instantiate_params_subst
({|
decl_name := na;
decl_body := Some bo;
decl_type := ty |} :: params) args s t =
Some (ctx, t')
Ast.wf t'
cbn in e.na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : match t with
| tLetIn _ _ _ b' =>
instantiate_params_subst params args
(subst0 s bo :: s) b'
| _ => None
end = Some (ctx, t')
Ast.wf t'
destruct t ; try discriminate .na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
na0 : aname
t1, t2, t3 : term
ctx : list term
t' : term
h : Ast.wf (tLetIn na0 t1 t2 t3)
e : instantiate_params_subst params args
(subst0 s bo :: s) t3 =
Some (ctx, t')
Ast.wf t'
eapply IHparams ; try exact e.na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
na0 : aname
t1, t2, t3 : term
ctx : list term
t' : term
h : Ast.wf (tLetIn na0 t1 t2 t3)
e : instantiate_params_subst params args
(subst0 s bo :: s) t3 =
Some (ctx, t')
Ast.wf t3
invs h. na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
na0 : aname
t1, t2, t3 : term
ctx : list term
t' : term
e : instantiate_params_subst params args
(subst0 s bo :: s) t3 =
Some (ctx, t')
H2 : Ast.wf t1
H4 : Ast.wf t2
H5 : Ast.wf t3
Ast.wf t3
assumption .
+ na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : instantiate_params_subst
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: params) args s t =
Some (ctx, t')
Ast.wf t'
cbn in e.na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
t : term
ctx : list term
t' : term
h : Ast.wf t
e : match t with
| tProd _ _ B =>
match args with
| [] => None
| hd :: tl =>
instantiate_params_subst params tl
(hd :: s) B
end
| _ => None
end = Some (ctx, t')
Ast.wf t'
destruct t ; try discriminate .na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Ast.wf t'0
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
h : Ast.wf (tProd na0 t1 t2)
e : match args with
| [] => None
| hd :: tl =>
instantiate_params_subst params tl
(hd :: s) t2
end = Some (ctx, t')
Ast.wf t'
destruct args ; try discriminate .na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Ast.wf t'0
t : term
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
h : Ast.wf (tProd na0 t1 t2)
e : instantiate_params_subst params args (t :: s) t2 =
Some (ctx, t')
Ast.wf t'
eapply IHparams ; try exact e.na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Ast.wf t'0
t : term
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
h : Ast.wf (tProd na0 t1 t2)
e : instantiate_params_subst params args (t :: s) t2 =
Some (ctx, t')
Ast.wf t2
invs h. na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Ast.wf t0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Ast.wf t'0
t : term
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
e : instantiate_params_subst params args (t :: s) t2 =
Some (ctx, t')
H1 : Ast.wf t1
H3 : Ast.wf t2
Ast.wf t2
assumption .
Qed .
Lemma wf_instantiate_params_subst_ctx :
forall params args s t ctx t' ,
Forall Ast.wf args ->
Forall wf_decl params ->
Forall Ast.wf s ->
instantiate_params_subst params args s t = Some (ctx, t') ->
Forall Ast.wf ctx.forall (params : list context_decl)
(args s : list term) (t : term) (ctx : list term)
(t' : term),
Forall Ast.wf args ->
Forall wf_decl params ->
Forall Ast.wf s ->
instantiate_params_subst params args s t =
Some (ctx, t') -> Forall Ast.wf ctx
Proof .forall (params : list context_decl)
(args s : list term) (t : term) (ctx : list term)
(t' : term),
Forall Ast.wf args ->
Forall wf_decl params ->
Forall Ast.wf s ->
instantiate_params_subst params args s t =
Some (ctx, t') -> Forall Ast.wf ctx
intros params args s t ctx t' ha hp hx e.params : list context_decl
args, s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl params
hx : Forall Ast.wf s
e : instantiate_params_subst params args s t =
Some (ctx, t')
Forall Ast.wf ctx
revert args s t ctx t' ha hp hx e.forall (args s : list term)
(t : term) (ctx : list term)
(t' : term),
Forall Ast.wf args ->
Forall wf_decl params ->
Forall Ast.wf s ->
instantiate_params_subst params args s t =
Some (ctx, t') -> Forall Ast.wf ctx
induction params ; intros args s t ctx t' ha hp hx e.args, s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl []
hx : Forall Ast.wf s
e : instantiate_params_subst [] args s t =
Some (ctx, t')
Forall Ast.wf ctx
- args, s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl []
hx : Forall Ast.wf s
e : instantiate_params_subst [] args s t =
Some (ctx, t')
Forall Ast.wf ctx
destruct args ; try discriminate .s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf []
hp : Forall wf_decl []
hx : Forall Ast.wf s
e : instantiate_params_subst [] [] s t =
Some (ctx, t')
Forall Ast.wf ctx
cbn in e.s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf []
hp : Forall wf_decl []
hx : Forall Ast.wf s
e : Some (s, t) = Some (ctx, t')
Forall Ast.wf ctx
inversion e.s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf []
hp : Forall wf_decl []
hx : Forall Ast.wf s
e : Some (s, t) = Some (ctx, t')
H0 : s = ctx
H1 : t = t'
Forall Ast.wf ctx
subst .ctx : list term
t' : term
ha : Forall Ast.wf []
hp : Forall wf_decl []
e : Some (ctx, t') = Some (ctx, t')
hx : Forall Ast.wf ctx
Forall Ast.wf ctx
assumption .
- a : context_decl
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl (a :: params)
hx : Forall Ast.wf s
e : instantiate_params_subst (a :: params) args s t =
Some (ctx, t')
Forall Ast.wf ctx
destruct a as [na [bo|] ty].na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl
({|
decl_name := na;
decl_body := Some bo;
decl_type := ty |} :: params)
hx : Forall Ast.wf s
e : instantiate_params_subst
({|
decl_name := na;
decl_body := Some bo;
decl_type := ty |} :: params) args s t =
Some (ctx, t')
Forall Ast.wf ctx
+ na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl
({|
decl_name := na;
decl_body := Some bo;
decl_type := ty |} :: params)
hx : Forall Ast.wf s
e : instantiate_params_subst
({|
decl_name := na;
decl_body := Some bo;
decl_type := ty |} :: params) args s t =
Some (ctx, t')
Forall Ast.wf ctx
cbn in e.na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl
({|
decl_name := na;
decl_body := Some bo;
decl_type := ty |} :: params)
hx : Forall Ast.wf s
e : match t with
| tLetIn _ _ _ b' =>
instantiate_params_subst params args
(subst0 s bo :: s) b'
| _ => None
end = Some (ctx, t')
Forall Ast.wf ctx
destruct t ; try discriminate .na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
na0 : aname
t1, t2, t3 : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl
({|
decl_name := na;
decl_body := Some bo;
decl_type := ty |} :: params)
hx : Forall Ast.wf s
e : instantiate_params_subst params args
(subst0 s bo :: s) t3 =
Some (ctx, t')
Forall Ast.wf ctx
invs hp. na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
na0 : aname
t1, t2, t3 : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hx : Forall Ast.wf s
e : instantiate_params_subst params args
(subst0 s bo :: s) t3 =
Some (ctx, t')
H1 : wf_decl
{|
decl_name := na;
decl_body := Some bo;
decl_type := ty |}
H2 : Forall wf_decl params
Forall Ast.wf ctx
destruct H1 as [h1 h2].na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
na0 : aname
t1, t2, t3 : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hx : Forall Ast.wf s
e : instantiate_params_subst params args
(subst0 s bo :: s) t3 =
Some (ctx, t')
h1 : match
decl_body
{|
decl_name := na;
decl_body := Some bo;
decl_type := ty |}
with
| Some b => Ast.wf b
| None => True
end
h2 : Ast.wf
(decl_type
{|
decl_name := na;
decl_body := Some bo;
decl_type := ty |})
H2 : Forall wf_decl params
Forall Ast.wf ctx
simpl in h1, h2.na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
na0 : aname
t1, t2, t3 : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hx : Forall Ast.wf s
e : instantiate_params_subst params args
(subst0 s bo :: s) t3 =
Some (ctx, t')
h1 : Ast.wf bo
h2 : Ast.wf ty
H2 : Forall wf_decl params
Forall Ast.wf ctx
eapply IHparams ; try exact e ; try assumption .na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
na0 : aname
t1, t2, t3 : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hx : Forall Ast.wf s
e : instantiate_params_subst params args
(subst0 s bo :: s) t3 =
Some (ctx, t')
h1 : Ast.wf bo
h2 : Ast.wf ty
H2 : Forall wf_decl params
Forall Ast.wf (subst0 s bo :: s)
constructor ; try assumption .na : aname
bo, ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
na0 : aname
t1, t2, t3 : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hx : Forall Ast.wf s
e : instantiate_params_subst params args
(subst0 s bo :: s) t3 =
Some (ctx, t')
h1 : Ast.wf bo
h2 : Ast.wf ty
H2 : Forall wf_decl params
Ast.wf (subst0 s bo)
eapply wf_subst ; assumption .
+ na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: params)
hx : Forall Ast.wf s
e : instantiate_params_subst
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: params) args s t =
Some (ctx, t')
Forall Ast.wf ctx
cbn in e.na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
t : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: params)
hx : Forall Ast.wf s
e : match t with
| tProd _ _ B =>
match args with
| [] => None
| hd :: tl =>
instantiate_params_subst params tl
(hd :: s) B
end
| _ => None
end = Some (ctx, t')
Forall Ast.wf ctx
destruct t ; try discriminate .na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
ha : Forall Ast.wf args
hp : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: params)
hx : Forall Ast.wf s
e : match args with
| [] => None
| hd :: tl =>
instantiate_params_subst params tl
(hd :: s) t2
end = Some (ctx, t')
Forall Ast.wf ctx
destruct args ; try discriminate .na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
t : term
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
ha : Forall Ast.wf (t :: args)
hp : Forall wf_decl
({|
decl_name := na;
decl_body := None;
decl_type := ty |} :: params)
hx : Forall Ast.wf s
e : instantiate_params_subst params args (t :: s) t2 =
Some (ctx, t')
Forall Ast.wf ctx
invs hp. na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
t : term
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
ha : Forall Ast.wf (t :: args)
hx : Forall Ast.wf s
e : instantiate_params_subst params args (t :: s) t2 =
Some (ctx, t')
H1 : wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
H2 : Forall wf_decl params
Forall Ast.wf ctx
simpl in *.na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
t : term
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
ha : Forall Ast.wf (t :: args)
hx : Forall Ast.wf s
e : instantiate_params_subst params args (t :: s) t2 =
Some (ctx, t')
H1 : wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
H2 : Forall wf_decl params
Forall Ast.wf ctx
invs ha. na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
t : term
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
hx : Forall Ast.wf s
e : instantiate_params_subst params args (t :: s) t2 =
Some (ctx, t')
H1 : wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
H2 : Forall wf_decl params
H3 : Ast.wf t
H4 : Forall Ast.wf args
Forall Ast.wf ctx
eapply IHparams ; try exact e ; try assumption .na : aname
ty : term
params : list context_decl
IHparams : forall (args0 s0 : list term)
(t0 : term) (ctx0 : list term)
(t'0 : term),
Forall Ast.wf args0 ->
Forall wf_decl params ->
Forall Ast.wf s0 ->
instantiate_params_subst params args0 s0 t0 =
Some (ctx0, t'0) -> Forall Ast.wf ctx0
t : term
args, s : list term
na0 : aname
t1, t2 : term
ctx : list term
t' : term
hx : Forall Ast.wf s
e : instantiate_params_subst params args (t :: s) t2 =
Some (ctx, t')
H1 : wf_decl
{|
decl_name := na;
decl_body := None;
decl_type := ty |}
H2 : Forall wf_decl params
H3 : Ast.wf t
H4 : Forall Ast.wf args
Forall Ast.wf (t :: s)
constructor ; assumption .
Qed .
(*
Lemma wf_instantiate_params :
forall params args t t',
Forall wf_decl params ->
Forall Ast.wf args ->
Ast.wf t ->
instantiate_params params args t = Some t' ->
Ast.wf t'.
Proof.
intros params args t t' hparamas hargs ht e.
unfold instantiate_params in e. revert e.
case_eq (instantiate_params_subst (List.rev params) args [] t) ; try discriminate.
intros [ctx u] eq e. inversion e. subst. clear e.
apply wf_instantiate_params_subst_term in eq as h1 ; trivial.
apply wf_instantiate_params_subst_ctx in eq as h2 ; trivial.
- eapply wf_subst ; trivial.
- eapply rev_Forall. assumption.
Qed. *)
Record wf_inductive_body idecl := {
wf_ind_type : Ast.wf (ind_type idecl);
wf_ind_ctors : Forall (fun cdecl => Ast.wf (cstr_type cdecl)) (ind_ctors idecl);
wf_ind_projs : Forall (fun pdecl => Ast.wf pdecl.2 ) (ind_projs idecl)
}.
Lemma declared_minductive_declared {cf :checker_flags} {Σ : global_env_ext} {mind } {mdecl } :
wf Σ.1 ->
declared_minductive Σ mind mdecl ->
(Alli (fun i decl => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl decl)
0 (ind_bodies mdecl)).cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wf Σ.1 ->
declared_minductive Σ mind mdecl ->
Alli
(fun (i : nat) (decl : one_inductive_body) =>
declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl decl) 0 (ind_bodies mdecl)
Proof .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wf Σ.1 ->
declared_minductive Σ mind mdecl ->
Alli
(fun (i : nat) (decl : one_inductive_body) =>
declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl decl) 0 (ind_bodies mdecl)
intros ; eapply forall_nth_error_Alli.cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
X : wf Σ.1
H : declared_minductive Σ mind mdecl
forall (i : nat) (x : one_inductive_body),
nth_error (ind_bodies mdecl) i = Some x ->
declared_inductive Σ
{| inductive_mind := mind; inductive_ind := 0 + i |}
mdecl x
intros ; split ; auto .
Qed .
Lemma declared_inductive_declared {cf :checker_flags} {Σ : global_env_ext}
{ind mdecl idecl } :
wf Σ.1 ->
declared_inductive Σ ind mdecl idecl ->
(Alli (fun i decl => declared_constructor Σ (ind, i) mdecl idecl decl) 0 (ind_ctors idecl)) *
(Alli (fun i decl => declared_projection Σ ((ind, ind_npars mdecl), i) mdecl idecl decl) 0 (ind_projs idecl)).cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
wf Σ.1 ->
declared_inductive Σ ind mdecl idecl ->
Alli
(fun (i : nat) (decl : constructor_body) =>
declared_constructor Σ (ind, i) mdecl idecl decl) 0
(ind_ctors idecl)
× Alli
(fun (i : nat) (decl : ident × term) =>
declared_projection Σ (ind, ind_npars mdecl, i)
mdecl idecl decl) 0 (ind_projs idecl)
Proof .cf : checker_flags
Σ : global_env_ext
ind : inductive
mdecl : mutual_inductive_body
idecl : one_inductive_body
wf Σ.1 ->
declared_inductive Σ ind mdecl idecl ->
Alli
(fun (i : nat) (decl : constructor_body) =>
declared_constructor Σ (ind, i) mdecl idecl decl) 0
(ind_ctors idecl)
× Alli
(fun (i : nat) (decl : ident × term) =>
declared_projection Σ
(ind, ind_npars mdecl, i) mdecl idecl decl) 0
(ind_projs idecl)
intros ; split ; eapply forall_nth_error_Alli; intros ; split ; auto .
Qed .
Lemma declared_minductive_wf {cf :checker_flags} {Σ : global_env_ext} {mind mdecl } :
wf Σ.1 ->
declared_minductive Σ mind mdecl ->
Forall wf_decl (ind_params mdecl) /\
Forall wf_inductive_body (ind_bodies mdecl).cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wf Σ.1 ->
declared_minductive Σ mind mdecl ->
Forall wf_decl (ind_params mdecl) /\
Forall wf_inductive_body (ind_bodies mdecl)
Proof .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wf Σ.1 ->
declared_minductive Σ mind mdecl ->
Forall wf_decl (ind_params mdecl) /\
Forall wf_inductive_body (ind_bodies mdecl)
intros wfΣ declm.cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
Forall wf_decl (ind_params mdecl) /\
Forall wf_inductive_body (ind_bodies mdecl)
pose proof (typing_wf_gen _ wfΣ _ localenv_nil _ _ (type_Prop _)) as [X _].cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
Forall wf_decl (ind_params mdecl) /\
Forall wf_inductive_body (ind_bodies mdecl)
split .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
Forall wf_decl (ind_params mdecl)
eapply lookup_on_global_env in declm as [? [? ?]]; eauto .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
x : global_env * universes_decl
x0 : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) x.1
o : on_global_decl
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) x mind
(InductiveDecl mdecl)
Forall wf_decl (ind_params mdecl)
red in o.cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
x : global_env * universes_decl
x0 : on_global_env
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) x.1
o : on_inductive
(TemplateEnvTyping.lift_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T)) x mind mdecl
Forall wf_decl (ind_params mdecl)
now apply (on_inductive_wf_params (ind:={|inductive_mind := mind; inductive_ind := 0 |})) in o.cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
Forall wf_inductive_body (ind_bodies mdecl)
eapply All_Forall.cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
All wf_inductive_body (ind_bodies mdecl)
move : (declared_minductive_declared wfΣ declm) => decli.cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i |} mdecl decl) 0
(ind_bodies mdecl)
All wf_inductive_body (ind_bodies mdecl)
eapply Alli_All; eauto .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i |} mdecl decl) 0
(ind_bodies mdecl)
forall (n : nat) (x : one_inductive_body),
(fun (i : nat) (decl : one_inductive_body) =>
declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl decl) n x -> wf_inductive_body x
intros i oib H.cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : (fun (i0 : nat) (decl : one_inductive_body) =>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) i oib
wf_inductive_body oib
simpl in H.cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
wf_inductive_body oib
destruct (declared_inductive_declared wfΣ H) as [declc declp].cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
declc : Alli
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, i0) mdecl oib
decl) 0 (ind_ctors oib)
declp : Alli
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) 0
(ind_projs oib)
wf_inductive_body oib
split .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
declc : Alli
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, i0) mdecl oib
decl) 0 (ind_ctors oib)
declp : Alli
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) 0
(ind_projs oib)
Ast.wf (ind_type oib)
now eapply declared_inductive_wf in H.cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
declc : Alli
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, i0) mdecl oib
decl) 0 (ind_ctors oib)
declp : Alli
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) 0
(ind_projs oib)
Forall
(fun cdecl : constructor_body =>
Ast.wf (cstr_type cdecl))
(ind_ctors oib)
eapply All_Forall, Alli_All; eauto .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
declc : Alli
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, i0) mdecl oib
decl) 0 (ind_ctors oib)
declp : Alli
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) 0
(ind_projs oib)
forall (n : nat) (x : constructor_body),
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({| inductive_mind := mind; inductive_ind := i |},
i0) mdecl oib decl) n x ->
Ast.wf (cstr_type x)
simpl ; intros .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
declc : Alli
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, i0) mdecl oib
decl) 0 (ind_ctors oib)
declp : Alli
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) 0
(ind_projs oib)
n : nat
x : constructor_body
H0 : declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, n) mdecl oib x
Ast.wf (cstr_type x)
eapply declared_constructor_wf in H0; eauto .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
declc : Alli
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, i0) mdecl oib
decl) 0 (ind_ctors oib)
declp : Alli
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) 0
(ind_projs oib)
n : nat
x : constructor_body
H0 : declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, n) mdecl oib x
list Level.t
exact [].cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
declc : Alli
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, i0) mdecl oib
decl) 0 (ind_ctors oib)
declp : Alli
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) 0
(ind_projs oib)
Forall (fun pdecl : ident × term => Ast.wf pdecl.2 )
(ind_projs oib)
eapply All_Forall, Alli_All; eauto .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
declc : Alli
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, i0) mdecl oib
decl) 0 (ind_ctors oib)
declp : Alli
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) 0
(ind_projs oib)
forall (n : nat) (x : ident × term),
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({| inductive_mind := mind; inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) n x ->
Ast.wf x.2
simpl ; intros .cf : checker_flags
Σ : global_env_ext
mind : kername
mdecl : mutual_inductive_body
wfΣ : wf Σ.1
declm : declared_minductive Σ mind mdecl
X : Forall_decls_typing
(fun (_ : global_env_ext)
(_ : context ) (t T : term) =>
Ast.wf t /\ Ast.wf T) Σ.1
decli : Alli
(fun (i0 : nat) (decl : one_inductive_body)
=>
declared_inductive Σ
{|
inductive_mind := mind;
inductive_ind := i0 |} mdecl decl) 0
(ind_bodies mdecl)
i : nat
oib : one_inductive_body
H : declared_inductive Σ
{| inductive_mind := mind; inductive_ind := i |}
mdecl oib
declc : Alli
(fun (i0 : nat) (decl : constructor_body) =>
declared_constructor Σ
({|
inductive_mind := mind;
inductive_ind := i |}, i0) mdecl oib
decl) 0 (ind_ctors oib)
declp : Alli
(fun (i0 : nat) (decl : ident × term) =>
declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, i0) mdecl oib decl) 0
(ind_projs oib)
n : nat
x : ident * term
H0 : declared_projection Σ
({|
inductive_mind := mind;
inductive_ind := i |},
ind_npars mdecl, n) mdecl oib x
Ast.wf x.2
eapply declared_projection_wf in H0; eauto .
Qed .
Lemma mkApp_ex_wf t u : Ast.wf (mkApp t u) ->
exists f args , mkApp t u = tApp f args /\ ~~ isApp f.Ast.wf (mkApp t u) ->
exists (f : term) (args : list term),
mkApp t u = tApp f args /\ ~~ isApp f
Proof .Ast.wf (mkApp t u) ->
exists (f : term) (args : list term),
mkApp t u = tApp f args /\ ~~ isApp f
induction t; simpl ; try solve [eexists _, _; split ; reflexivity ].t : term
args : list term
u : term
IHt : Ast.wf (mkApp t u) ->
exists (f : term) (args0 : list term),
mkApp t u = tApp f args0 /\ ~~ isApp f
Ast.wf (tApp t (args ++ [u])) ->
exists (f : term) (args0 : list term),
tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
intros wf .t : term
args : list term
u : term
IHt : Ast.wf (mkApp t u) ->
exists (f : term) (args0 : list term),
mkApp t u = tApp f args0 /\ ~~ isApp f
wf : Ast.wf (tApp t (args ++ [u]))
exists (f : term) (args0 : list term),
tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
eapply wf_inv in wf as [appt [_ [wft wfargs]]].t : term
args : list term
u : term
IHt : Ast.wf (mkApp t u) ->
exists (f : term) (args0 : list term),
mkApp t u = tApp f args0 /\ ~~ isApp f
appt : isApp t = false
wft : Ast.wf t
wfargs : Forall Ast.wf (args ++ [u])
exists (f : term) (args0 : list term),
tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
eapply Forall_app in wfargs as [wfargs wfu].t : term
args : list term
u : term
IHt : Ast.wf (mkApp t u) ->
exists (f : term) (args0 : list term),
mkApp t u = tApp f args0 /\ ~~ isApp f
appt : isApp t = false
wft : Ast.wf t
wfargs : Forall Ast.wf args
wfu : Forall Ast.wf [u]
exists (f : term) (args0 : list term),
tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
depelim wfu. t : term
args : list term
u : term
IHt : Ast.wf (mkApp t u) ->
exists (f : term) (args0 : list term),
mkApp t u = tApp f args0 /\ ~~ isApp f
appt : isApp t = false
wft : Ast.wf t
wfargs : Forall Ast.wf args
H : Ast.wf u
wfu : Forall Ast.wf []
exists (f : term) (args0 : list term),
tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
forward IHt. t : term
args : list term
u : term
IHt : Ast.wf (mkApp t u) ->
exists (f : term) (args0 : list term),
mkApp t u = tApp f args0 /\ ~~ isApp f
appt : isApp t = false
wft : Ast.wf t
wfargs : Forall Ast.wf args
H : Ast.wf u
wfu : Forall Ast.wf []
Ast.wf (mkApp t u)
eapply wf_mkApp; intuition auto .t : term
args : list term
u : term
IHt : exists (f : term) (args0 : list term),
mkApp t u = tApp f args0 /\ ~~ isApp f
appt : isApp t = false
wft : Ast.wf t
wfargs : Forall Ast.wf args
H : Ast.wf u
wfu : Forall Ast.wf []
exists (f : term) (args0 : list term),
tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
destruct IHt as [f [ar [eqf isap]]].t : term
args : list term
u, f : term
ar : list term
eqf : mkApp t u = tApp f ar
isap : is_true (~~ isApp f)
appt : isApp t = false
wft : Ast.wf t
wfargs : Forall Ast.wf args
H : Ast.wf u
wfu : Forall Ast.wf []
exists (f0 : term) (args0 : list term),
tApp t (args ++ [u]) = tApp f0 args0 /\ ~~ isApp f0
eexists _, _; split ; auto .t : term
args : list term
u, f : term
ar : list term
eqf : mkApp t u = tApp f ar
isap : is_true (~~ isApp f)
appt : isApp t = false
wft : Ast.wf t
wfargs : Forall Ast.wf args
H : Ast.wf u
wfu : Forall Ast.wf []
is_true (~~ isApp t)
rewrite appt //.
Qed .
Lemma decompose_app_mkApp f u :
(decompose_app (mkApp f u)).2 <> [].(decompose_app (mkApp f u)).2 <> []
Proof .(decompose_app (mkApp f u)).2 <> []
induction f; simpl ; auto ; try congruence .f : term
args : list term
u : term
IHf : (decompose_app (mkApp f u)).2 <> []
args ++ [u] <> []
destruct args; simpl ; congruence .
Qed .
Lemma mkApps_tApp' f u f' u' :
~~ isApp f' ->
mkApp f u = tApp f' u' -> mkApps f [u] = mkApps f' u'.f, u, f' : term
u' : list term
~~ isApp f' ->
mkApp f u = tApp f' u' -> mkApps f [u] = mkApps f' u'
Proof .f, u, f' : term
u' : list term
~~ isApp f' ->
mkApp f u = tApp f' u' -> mkApps f [u] = mkApps f' u'
intros .f, u, f' : term
u' : list term
H : is_true (~~ isApp f')
H0 : mkApp f u = tApp f' u'
mkApps f [u] = mkApps f' u'
rewrite -(mkApp_mkApps f u []).f, u, f' : term
u' : list term
H : is_true (~~ isApp f')
H0 : mkApp f u = tApp f' u'
mkApp (mkApps f []) u = mkApps f' u'
simpl .f, u, f' : term
u' : list term
H : is_true (~~ isApp f')
H0 : mkApp f u = tApp f' u'
mkApp f u = mkApps f' u'
rewrite H0.f, u, f' : term
u' : list term
H : is_true (~~ isApp f')
H0 : mkApp f u = tApp f' u'
tApp f' u' = mkApps f' u'
rewrite -(mkApps_tApp f') // ?H //.f, u, f' : term
u' : list term
H : is_true (~~ isApp f')
H0 : mkApp f u = tApp f' u'
is_true (~~ is_empty u')
destruct u' => //.f, u, f' : term
H : is_true (~~ isApp f')
H0 : mkApp f u = tApp f' []
is_true (~~ is_empty [])
eapply (f_equal decompose_app) in H0.f, u, f' : term
H : is_true (~~ isApp f')
H0 : decompose_app (mkApp f u) =
decompose_app (tApp f' [])
is_true (~~ is_empty [])
simpl in H0.f, u, f' : term
H : is_true (~~ isApp f')
H0 : decompose_app (mkApp f u) = (f', [])
is_true (~~ is_empty [])
pose proof (decompose_app_mkApp f u).f, u, f' : term
H : is_true (~~ isApp f')
H0 : decompose_app (mkApp f u) = (f', [])
H1 : (decompose_app (mkApp f u)).2 <> []
is_true (~~ is_empty [])
rewrite H0 /= in H1.f, u, f' : term
H : is_true (~~ isApp f')
H0 : decompose_app (mkApp f u) = (f', [])
H1 : [] <> []
is_true (~~ is_empty [])
congruence .
Qed .
Lemma eq_decompose_app x y :
Ast.wf x -> Ast.wf y ->
decompose_app x = decompose_app y -> x = y.Ast.wf x ->
Ast.wf y -> decompose_app x = decompose_app y -> x = y
Proof .Ast.wf x ->
Ast.wf y -> decompose_app x = decompose_app y -> x = y
intros wfx; revert y.forall y : term,
Ast.wf y -> decompose_app x = decompose_app y -> x = y
induction wfx using term_wf_forall_list_ind; intros [] wfy;
eapply wf_inv in wfy; simpl in wfy; simpl ;
intros [= ?]; try intuition congruence .
Qed .
Lemma mkApp_ex t u : ∑ f args, mkApp t u = tApp f args.∑ (f : term) (args : list term),
mkApp t u = tApp f args
Proof .∑ (f : term) (args : list term),
mkApp t u = tApp f args
induction t; simpl ; try solve [eexists _, _; reflexivity ].
Qed .
Lemma strip_casts_decompose_app t :
Ast.wf t ->
forall f l , decompose_app t = (f, l) ->
strip_casts t = mkApps (strip_casts f) (map strip_casts l).Ast.wf t ->
forall (f : term) (l : list term),
decompose_app t = (f, l) ->
strip_casts t =
mkApps (strip_casts f) (map strip_casts l)
Proof .Ast.wf t ->
forall (f : term) (l : list term),
decompose_app t = (f, l) ->
strip_casts t =
mkApps (strip_casts f) (map strip_casts l)
intros wf .forall (f : term) (l : list term),
decompose_app t = (f, l) ->
strip_casts t =
mkApps (strip_casts f) (map strip_casts l)
induction wf using term_wf_forall_list_ind; simpl ; intros ; auto ; noconf H;
try noconf H0;
rewrite ?map_map_compose ?compose_on_snd ?compose_map_def ?map_length ;
f_equal ; solve_all; eauto .t : term
H : isApp t = false
wf : Ast.wf t
l : list term
H0 : l = [] -> False
H2 : All
(fun x : term =>
Ast.wf x *
(forall (f0 : term) (l1 : list term),
decompose_app x = (f0, l1) ->
strip_casts x =
mkApps (strip_casts f0) (map strip_casts l1)))
l
IHwf : forall (f0 : term) (l1 : list term),
decompose_app t = (f0, l1) ->
strip_casts t =
mkApps (strip_casts f0) (map strip_casts l1)
f : term
l0 : list term
H3 : (t, l) = (f, l0)
strip_casts t = strip_casts f
- t : term
H : isApp t = false
wf : Ast.wf t
l : list term
H0 : l = [] -> False
H2 : All
(fun x : term =>
Ast.wf x *
(forall (f0 : term) (l1 : list term),
decompose_app x = (f0, l1) ->
strip_casts x =
mkApps (strip_casts f0) (map strip_casts l1)))
l
IHwf : forall (f0 : term) (l1 : list term),
decompose_app t = (f0, l1) ->
strip_casts t =
mkApps (strip_casts f0) (map strip_casts l1)
f : term
l0 : list term
H3 : (t, l) = (f, l0)
strip_casts t = strip_casts f
now noconf H3.
- t : term
H : isApp t = false
wf : Ast.wf t
l : list term
H0 : l = [] -> False
H2 : All
(fun x : term =>
Ast.wf x *
(forall (f0 : term) (l1 : list term),
decompose_app x = (f0, l1) ->
strip_casts x =
mkApps (strip_casts f0) (map strip_casts l1)))
l
IHwf : forall (f0 : term) (l1 : list term),
decompose_app t = (f0, l1) ->
strip_casts t =
mkApps (strip_casts f0) (map strip_casts l1)
f : term
l0 : list term
H3 : (t, l) = (f, l0)
map strip_casts l = map strip_casts l0
now noconf H3.
Qed .
Lemma mkApps_tApp f args :
~~ isApp f ->
~~ is_empty args ->
tApp f args = mkApps f args.~~ isApp f ->
~~ is_empty args -> tApp f args = mkApps f args
Proof .~~ isApp f ->
~~ is_empty args -> tApp f args = mkApps f args
intros .f : term
args : list term
H : is_true (~~ isApp f)
H0 : is_true (~~ is_empty args)
tApp f args = mkApps f args
destruct args, f; try discriminate ; auto .
Qed .
Lemma strip_casts_mkApps_napp_wf f u :
~~ isApp f -> Ast.wf f -> Forall Ast.wf u ->
strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u).~~ isApp f ->
Ast.wf f ->
Forall Ast.wf u ->
strip_casts (mkApps f u) =
mkApps (strip_casts f) (map strip_casts u)
Proof .~~ isApp f ->
Ast.wf f ->
Forall Ast.wf u ->
strip_casts (mkApps f u) =
mkApps (strip_casts f) (map strip_casts u)
intros nisapp wf wf'.f : term
u : list term
nisapp : is_true (~~ isApp f)
wf : Ast.wf f
wf' : Forall Ast.wf u
strip_casts (mkApps f u) =
mkApps (strip_casts f) (map strip_casts u)
destruct u.f : term
nisapp : is_true (~~ isApp f)
wf : Ast.wf f
wf' : Forall Ast.wf []
strip_casts (mkApps f []) =
mkApps (strip_casts f) (map strip_casts [])
simpl .f : term
nisapp : is_true (~~ isApp f)
wf : Ast.wf f
wf' : Forall Ast.wf []
strip_casts f = strip_casts f
auto .f, t : term
u : list term
nisapp : is_true (~~ isApp f)
wf : Ast.wf f
wf' : Forall Ast.wf (t :: u)
strip_casts (mkApps f (t :: u)) =
mkApps (strip_casts f) (map strip_casts (t :: u))
rewrite -(mkApps_tApp f (t :: u)) //.
Qed .
Lemma mkApp_mkApps f u : mkApp f u = mkApps f [u].
Proof . reflexivity . Qed .
Lemma decompose_app_inv f l hd args :
Ast.wf f ->
decompose_app (mkApps f l) = (hd, args) ->
∑ n, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args).f : term
l : list term
hd : term
args : list term
Ast.wf f ->
decompose_app (mkApps f l) = (hd, args) ->
∑ n : nat,
~~ isApp hd /\
l = skipn n args /\ f = mkApps hd (firstn n args)
Proof .f : term
l : list term
hd : term
args : list term
Ast.wf f ->
decompose_app (mkApps f l) = (hd, args) ->
∑ n : nat,
~~ isApp hd /\
l = skipn n args /\ f = mkApps hd (firstn n args)
destruct (isApp f) eqn :Heq.f : term
l : list term
hd : term
args : list term
Heq : isApp f = true
Ast.wf f ->
decompose_app (mkApps f l) = (hd, args) ->
∑ n : nat,
~~ isApp hd /\
l = skipn n args /\ f = mkApps hd (firstn n args)
revert l args hd.forall (l args : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l) = (hd, args) ->
∑ n : nat,
~~ isApp hd /\
l = skipn n args /\ f = mkApps hd (firstn n args)
induction f; try discriminate .f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l = skipn n args0 /\
f = mkApps hd (firstn n args0)
forall (l args0 : list term) (hd : term),
Ast.wf (tApp f args) ->
decompose_app (mkApps (tApp f args) l) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l = skipn n args0 /\
tApp f args = mkApps hd (firstn n args0)
intros .f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args1 : list term) (hd0 : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd0, args1) ->
∑ n : nat,
~~ isApp hd0 /\
l0 = skipn n args1 /\
f = mkApps hd0 (firstn n args1)
l, args0 : list term
hd : term
H : Ast.wf (tApp f args)
H0 : decompose_app (mkApps (tApp f args) l) =
(hd, args0)
∑ n : nat,
~~ isApp hd /\
l = skipn n args0 /\
tApp f args = mkApps hd (firstn n args0)
simpl in H.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args1 : list term) (hd0 : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd0, args1) ->
∑ n : nat,
~~ isApp hd0 /\
l0 = skipn n args1 /\
f = mkApps hd0 (firstn n args1)
l, args0 : list term
hd : term
H : Ast.wf (tApp f args)
H0 : decompose_app (mkApps (tApp f args) l) =
(hd, args0)
∑ n : nat,
~~ isApp hd /\
l = skipn n args0 /\
tApp f args = mkApps hd (firstn n args0)
move /wf_inv: H => /= [isAppf [Hargs [wff wfargs]]].f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args1 : list term) (hd0 : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd0, args1) ->
∑ n : nat,
~~ isApp hd0 /\
l0 = skipn n args1 /\
f = mkApps hd0 (firstn n args1)
l, args0 : list term
hd : term
H0 : decompose_app (mkApps (tApp f args) l) =
(hd, args0)
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
∑ n : nat,
~~ isApp hd /\
l = skipn n args0 /\
tApp f args = mkApps hd (firstn n args0)
rewrite mkApps_tApp ?isAppf in H0 => //.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args1 : list term) (hd0 : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd0, args1) ->
∑ n : nat,
~~ isApp hd0 /\
l0 = skipn n args1 /\
f = mkApps hd0 (firstn n args1)
l, args0 : list term
hd : term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
is_true (~~ is_empty args)
destruct args => //.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args1 : list term) (hd0 : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd0, args1) ->
∑ n : nat,
~~ isApp hd0 /\
l0 = skipn n args1 /\
f = mkApps hd0 (firstn n args1)
l, args0 : list term
hd : term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
H0 : decompose_app (mkApps (mkApps f args) l) =
(hd, args0)
∑ n : nat,
~~ isApp hd /\
l = skipn n args0 /\
tApp f args = mkApps hd (firstn n args0)
rewrite mkApps_nested in H0.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args1 : list term) (hd0 : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd0, args1) ->
∑ n : nat,
~~ isApp hd0 /\
l0 = skipn n args1 /\
f = mkApps hd0 (firstn n args1)
l, args0 : list term
hd : term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
H0 : decompose_app (mkApps f (args ++ l)) =
(hd, args0)
∑ n : nat,
~~ isApp hd /\
l = skipn n args0 /\
tApp f args = mkApps hd (firstn n args0)
rewrite decompose_app_mkApps ?isAppf in H0; auto .f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args1 : list term) (hd0 : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd0, args1) ->
∑ n : nat,
~~ isApp hd0 /\
l0 = skipn n args1 /\
f = mkApps hd0 (firstn n args1)
l, args0 : list term
hd : term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
H0 : (f, args ++ l) = (hd, args0)
∑ n : nat,
~~ isApp hd /\
l = skipn n args0 /\
tApp f args = mkApps hd (firstn n args0)
noconf H0. f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
∑ n : nat,
~~ isApp f /\
l = skipn n (args ++ l) /\
tApp f args = mkApps f (firstn n (args ++ l))
exists #|args|; split ; auto .f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
is_true (~~ isApp f)
now rewrite isAppf.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
l = skipn #|args| (args ++ l) /\
tApp f args = mkApps f (firstn #|args| (args ++ l))
rewrite skipn_all_app.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
l = l /\
tApp f args = mkApps f (firstn #|args| (args ++ l))
rewrite firstn_app.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
l = l /\
tApp f args =
mkApps f
(firstn #|args| args ++ firstn (#|args| - #|args|) l)
rewrite firstn_all2.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
#|args| <= #|args|
lia .f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
l = l /\
tApp f args =
mkApps f (args ++ firstn (#|args| - #|args|) l)
rewrite Nat.sub_diag firstn_O app_nil_r.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
l = l /\ tApp f args = mkApps f args
split ; auto .f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
tApp f args = mkApps f args
rewrite mkApps_tApp ?isAppf //.f : term
args : list term
Heq : isApp (tApp f args) = true
IHf : isApp f = true ->
forall (l0 args0 : list term) (hd : term),
Ast.wf f ->
decompose_app (mkApps f l0) = (hd, args0) ->
∑ n : nat,
~~ isApp hd /\
l0 = skipn n args0 /\
f = mkApps hd (firstn n args0)
l : list term
isAppf : isApp f = false
Hargs : args <> []
wff : Ast.wf f
wfargs : Forall Ast.wf args
is_true (~~ is_empty args)
now destruct args.f : term
l : list term
hd : term
args : list term
Heq : isApp f = false
Ast.wf f ->
decompose_app (mkApps f l) = (hd, args) ->
∑ n : nat,
~~ isApp hd /\
l = skipn n args /\ f = mkApps hd (firstn n args)
intros wff fl.f : term
l : list term
hd : term
args : list term
Heq : isApp f = false
wff : Ast.wf f
fl : decompose_app (mkApps f l) = (hd, args)
∑ n : nat,
~~ isApp hd /\
l = skipn n args /\ f = mkApps hd (firstn n args)
rewrite decompose_app_mkApps in fl; auto .f : term
l : list term
hd : term
args : list term
Heq : isApp f = false
wff : Ast.wf f
is_true (~~ isApp f)
now apply negbT.f : term
l : list term
hd : term
args : list term
Heq : isApp f = false
wff : Ast.wf f
fl : (f, l) = (hd, args)
∑ n : nat,
~~ isApp hd /\
l = skipn n args /\ f = mkApps hd (firstn n args)
inversion fl.f : term
l : list term
hd : term
args : list term
Heq : isApp f = false
wff : Ast.wf f
fl : (f, l) = (hd, args)
H0 : f = hd
H1 : l = args
∑ n : nat,
~~ isApp hd /\
args = skipn n args /\
hd = mkApps hd (firstn n args)
subst ; exists 0 .hd : term
args : list term
fl : (hd, args) = (hd, args)
wff : Ast.wf hd
Heq : isApp hd = false
~~ isApp hd /\
args = skipn 0 args /\ hd = mkApps hd (firstn 0 args)
split ; auto .hd : term
args : list term
fl : (hd, args) = (hd, args)
wff : Ast.wf hd
Heq : isApp hd = false
is_true (~~ isApp hd)
now eapply negbT.
Qed .
Lemma eq_tip_skipn {A } (x : A) n l : [x] = skipn n l ->
exists l' , l = l' ++ [x] /\ n = #|l'|.[x] = skipn n l ->
exists l' : list A, l = l' ++ [x] /\ n = #|l'|
Proof .[x] = skipn n l ->
exists l' : list A, l = l' ++ [x] /\ n = #|l'|
induction l in n |- *.[x] = skipn n [] ->
exists l' : list A, [] = l' ++ [x] /\ n = #|l'|
rewrite skipn_nil //.A : Type
x : A
n : nat
a : A
l : list A
IHl : forall n0 : nat,
[x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
[x] = skipn n (a :: l) ->
exists l' : list A, a :: l = l' ++ [x] /\ n = #|l'|
destruct n.A : Type
x, a : A
l : list A
IHl : forall n : nat,
[x] = skipn n l -> exists l' : list A, l = l' ++ [x] /\ n = #|l'|
[x] = skipn 0 (a :: l) ->
exists l' : list A, a :: l = l' ++ [x] /\ 0 = #|l'|
simpl .A : Type
x, a : A
l : list A
IHl : forall n : nat,
[x] = skipn n l -> exists l' : list A, l = l' ++ [x] /\ n = #|l'|
[x] = a :: l ->
exists l' : list A, a :: l = l' ++ [x] /\ 0 = #|l'|
destruct l => //.A : Type
x, a : A
IHl : forall n : nat,
[x] = skipn n [] -> exists l' : list A, [] = l' ++ [x] /\ n = #|l'|
[x] = [a] ->
exists l' : list A, [a] = l' ++ [x] /\ 0 = #|l'|
intros eq.A : Type
x, a : A
IHl : forall n : nat,
[x] = skipn n [] -> exists l' : list A, [] = l' ++ [x] /\ n = #|l'|
eq : [x] = [a]
exists l' : list A, [a] = l' ++ [x] /\ 0 = #|l'|
noconf eq. A : Type
x : A
IHl : forall n : nat,
[x] = skipn n [] -> exists l' : list A, [] = l' ++ [x] /\ n = #|l'|
exists l' : list A, [x] = l' ++ [x] /\ 0 = #|l'|
exists []; split ; auto .A : Type
x : A
n : nat
a : A
l : list A
IHl : forall n0 : nat,
[x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
[x] = skipn (S n) (a :: l) ->
exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
rewrite skipn_S.A : Type
x : A
n : nat
a : A
l : list A
IHl : forall n0 : nat,
[x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
[x] = skipn n l ->
exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
intros Hx.A : Type
x : A
n : nat
a : A
l : list A
IHl : forall n0 : nat,
[x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
Hx : [x] = skipn n l
exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
destruct (IHl _ Hx) as [l' [-> ->]].A : Type
x, a : A
l' : list A
Hx : [x] = skipn #|l'| (l' ++ [x])
IHl : forall n : nat,
[x] = skipn n (l' ++ [x]) ->
exists l'0 : list A, l' ++ [x] = l'0 ++ [x] /\ n = #|l'0|
exists l'0 : list A,
a :: l' ++ [x] = l'0 ++ [x] /\ S #|l'| = #|l'0|
exists (a :: l'); split ; reflexivity .
Qed .
Lemma strip_casts_mkApp_wf f u :
Ast.wf f -> Ast.wf u ->
strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u).Ast.wf f ->
Ast.wf u ->
strip_casts (mkApp f u) =
mkApp (strip_casts f) (strip_casts u)
Proof .Ast.wf f ->
Ast.wf u ->
strip_casts (mkApp f u) =
mkApp (strip_casts f) (strip_casts u)
intros wf wf'.f, u : term
wf : Ast.wf f
wf' : Ast.wf u
strip_casts (mkApp f u) =
mkApp (strip_casts f) (strip_casts u)
assert (wfa : Ast.wf (mkApp f u)).f, u : term
wf : Ast.wf f
wf' : Ast.wf u
Ast.wf (mkApp f u)
now apply wf_mkApp.f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
strip_casts (mkApp f u) =
mkApp (strip_casts f) (strip_casts u)
destruct (mkApp_ex_wf f u wfa) as [f' [args [eq isapp]]].f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
args : list term
eq : mkApp f u = tApp f' args
isapp : is_true (~~ isApp f')
strip_casts (mkApp f u) =
mkApp (strip_casts f) (strip_casts u)
eapply (f_equal decompose_app) in eq.f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
args : list term
eq : decompose_app (mkApp f u) =
decompose_app (tApp f' args)
isapp : is_true (~~ isApp f')
strip_casts (mkApp f u) =
mkApp (strip_casts f) (strip_casts u)
simpl in eq.f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
args : list term
eq : decompose_app (mkApp f u) = (f', args)
isapp : is_true (~~ isApp f')
strip_casts (mkApp f u) =
mkApp (strip_casts f) (strip_casts u)
epose proof (strip_casts_decompose_app _ wfa _ _ eq).f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
args : list term
eq : decompose_app (mkApp f u) = (f', args)
isapp : is_true (~~ isApp f')
H : strip_casts (mkApp f u) =
mkApps (strip_casts f') (map strip_casts args)
strip_casts (mkApp f u) =
mkApp (strip_casts f) (strip_casts u)
rewrite H.f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
args : list term
eq : decompose_app (mkApp f u) = (f', args)
isapp : is_true (~~ isApp f')
H : strip_casts (mkApp f u) =
mkApps (strip_casts f') (map strip_casts args)
mkApps (strip_casts f') (map strip_casts args) =
mkApp (strip_casts f) (strip_casts u)
rewrite mkApp_mkApps in eq.f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
args : list term
isapp : is_true (~~ isApp f')
H : strip_casts (mkApp f u) =
mkApps (strip_casts f') (map strip_casts args)
eq : decompose_app (mkApps f [u]) = (f', args)
mkApps (strip_casts f') (map strip_casts args) =
mkApp (strip_casts f) (strip_casts u)
destruct (decompose_app_inv _ _ _ _ wf eq) as [n [ng [stripeq stripf]]].f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
args : list term
isapp : is_true (~~ isApp f')
H : strip_casts (mkApp f u) =
mkApps (strip_casts f') (map strip_casts args)
eq : decompose_app (mkApps f [u]) = (f', args)
n : nat
ng : is_true (~~ isApp f')
stripeq : [u] = skipn n args
stripf : f = mkApps f' (firstn n args)
mkApps (strip_casts f') (map strip_casts args) =
mkApp (strip_casts f) (strip_casts u)
apply eq_tip_skipn in stripeq.f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
args : list term
isapp : is_true (~~ isApp f')
H : strip_casts (mkApp f u) =
mkApps (strip_casts f') (map strip_casts args)
eq : decompose_app (mkApps f [u]) = (f', args)
n : nat
ng : is_true (~~ isApp f')
stripeq : exists l' : list term,
args = l' ++ [u] /\ n = #|l'|
stripf : f = mkApps f' (firstn n args)
mkApps (strip_casts f') (map strip_casts args) =
mkApp (strip_casts f) (strip_casts u)
destruct stripeq as [l' [eqargs eqn ]].f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
args : list term
isapp : is_true (~~ isApp f')
H : strip_casts (mkApp f u) =
mkApps (strip_casts f') (map strip_casts args)
eq : decompose_app (mkApps f [u]) = (f', args)
n : nat
ng : is_true (~~ isApp f')
l' : list term
eqargs : args = l' ++ [u]
eqn : n = #|l'|
stripf : f = mkApps f' (firstn n args)
mkApps (strip_casts f') (map strip_casts args) =
mkApp (strip_casts f) (strip_casts u)
subst n args.f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
isapp : is_true (~~ isApp f')
l' : list term
eq : decompose_app (mkApps f [u]) = (f', l' ++ [u])
H : strip_casts (mkApp f u) =
mkApps (strip_casts f')
(map strip_casts (l' ++ [u]))
ng : is_true (~~ isApp f')
stripf : f = mkApps f' (firstn #|l'| (l' ++ [u]))
mkApps (strip_casts f') (map strip_casts (l' ++ [u])) =
mkApp (strip_casts f) (strip_casts u)
rewrite (firstn_app_left _ 0 ) // /= app_nil_r in stripf.f, u : term
wf : Ast.wf f
wf' : Ast.wf u
wfa : Ast.wf (mkApp f u)
f' : term
isapp : is_true (~~ isApp f')
l' : list term
eq : decompose_app (mkApps f [u]) = (f', l' ++ [u])
H : strip_casts (mkApp f u) =
mkApps (strip_casts f')
(map strip_casts (l' ++ [u]))
ng : is_true (~~ isApp f')
stripf : f = mkApps f' l'
mkApps (strip_casts f') (map strip_casts (l' ++ [u])) =
mkApp (strip_casts f) (strip_casts u)
subst f.u, f' : term
l' : list term
H : strip_casts (mkApp (mkApps f' l') u) =
mkApps (strip_casts f')
(map strip_casts (l' ++ [u]))
eq : decompose_app (mkApps (mkApps f' l') [u]) =
(f', l' ++ [u])
wf : Ast.wf (mkApps f' l')
wf' : Ast.wf u
wfa : Ast.wf (mkApp (mkApps f' l') u)
isapp, ng : is_true (~~ isApp f')
mkApps (strip_casts f') (map strip_casts (l' ++ [u])) =
mkApp (strip_casts (mkApps f' l')) (strip_casts u)
eapply wf_mkApps_napp in wf as [wff' wfl] => //.u, f' : term
l' : list term
H : strip_casts (mkApp (mkApps f' l') u) =
mkApps (strip_casts f')
(map strip_casts (l' ++ [u]))
eq : decompose_app (mkApps (mkApps f' l') [u]) =
(f', l' ++ [u])
wf' : Ast.wf u
wfa : Ast.wf (mkApp (mkApps f' l') u)
isapp, ng : is_true (~~ isApp f')
wff' : Ast.wf f'
wfl : Forall Ast.wf l'
mkApps (strip_casts f') (map strip_casts (l' ++ [u])) =
mkApp (strip_casts (mkApps f' l')) (strip_casts u)
rewrite strip_casts_mkApps_napp_wf //.u, f' : term
l' : list term
H : strip_casts (mkApp (mkApps f' l') u) =
mkApps (strip_casts f')
(map strip_casts (l' ++ [u]))
eq : decompose_app (mkApps (mkApps f' l') [u]) =
(f', l' ++ [u])
wf' : Ast.wf u
wfa : Ast.wf (mkApp (mkApps f' l') u)
isapp, ng : is_true (~~ isApp f')
wff' : Ast.wf f'
wfl : Forall Ast.wf l'
mkApps (strip_casts f') (map strip_casts (l' ++ [u])) =
mkApp (mkApps (strip_casts f') (map strip_casts l'))
(strip_casts u)
now rewrite mkApp_mkApps mkApps_nested map_app.
Qed .
Lemma strip_casts_mkApps_wf f u :
Ast.wf f -> Forall Ast.wf u ->
strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u).Ast.wf f ->
Forall Ast.wf u ->
strip_casts (mkApps f u) =
mkApps (strip_casts f) (map strip_casts u)
Proof .Ast.wf f ->
Forall Ast.wf u ->
strip_casts (mkApps f u) =
mkApps (strip_casts f) (map strip_casts u)
intros wf wf'.f : term
u : list term
wf : Ast.wf f
wf' : Forall Ast.wf u
strip_casts (mkApps f u) =
mkApps (strip_casts f) (map strip_casts u)
induction wf' in f, wf |- *.strip_casts (mkApps f []) =
mkApps (strip_casts f) (map strip_casts [])
simpl .strip_casts f = strip_casts f
auto .f : term
wf : Ast.wf f
x : term
l : list term
H : Ast.wf x
wf' : Forall Ast.wf l
IHwf' : forall f0 : term,
Ast.wf f0 ->
strip_casts (mkApps f0 l) =
mkApps (strip_casts f0) (map strip_casts l)
strip_casts (mkApps f (x :: l)) =
mkApps (strip_casts f) (map strip_casts (x :: l))
rewrite -mkApps_mkApp IHwf'.f : term
wf : Ast.wf f
x : term
l : list term
H : Ast.wf x
wf' : Forall Ast.wf l
IHwf' : forall f0 : term,
Ast.wf f0 ->
strip_casts (mkApps f0 l) =
mkApps (strip_casts f0) (map strip_casts l)
Ast.wf (mkApp f x)
apply wf_mkApp; auto with wf .f : term
wf : Ast.wf f
x : term
l : list term
H : Ast.wf x
wf' : Forall Ast.wf l
IHwf' : forall f0 : term,
Ast.wf f0 ->
strip_casts (mkApps f0 l) =
mkApps (strip_casts f0) (map strip_casts l)
mkApps (strip_casts (mkApp f x)) (map strip_casts l) =
mkApps (strip_casts f) (map strip_casts (x :: l))
rewrite strip_casts_mkApp_wf //.f : term
wf : Ast.wf f
x : term
l : list term
H : Ast.wf x
wf' : Forall Ast.wf l
IHwf' : forall f0 : term,
Ast.wf f0 ->
strip_casts (mkApps f0 l) =
mkApps (strip_casts f0) (map strip_casts l)
mkApps (mkApp (strip_casts f) (strip_casts x))
(map strip_casts l) =
mkApps (strip_casts f) (map strip_casts (x :: l))
now rewrite mkApps_mkApp.
Qed .